I need to make a recycle bin code using bash my problem is that i dont know how to get the previous path of the files that ive deleted so when i restore it it will go to the directory that it was deleted from ive tried putting the paths to a txt file so i can read it but my problem is if there are multiple files how will i know what to read. Can you give mo suggestions on how to approch this problem im kinda lost now heres to code
#!/bin/bash
mkdir -p "$HOME/Trash"
if [ $1 = -restore ]; then
while read file; do
mv $HOME/Trash/$2 /$file
done < try.txt
else
if [ $1 = -restoreall ]; then
mv $HOME/Trash/* /$PWD
else
if [ $1 = -empty ]; then
rm -rfv /$HOME/Trash/*
else
mv $PWD/"$1"/$HOME/Trash
echo -n "$PWD" >> /$HOME/Bash/try
fi
fi
fi