How to append an existing file?
The existing file in the mywastebasket will have the version number zero appended to it and the newly deleted file will have version number 1 appended to it.
How the loop looks like?
read file
if [ ! -e "$file" ]
then
echo "$file does not exist"
exit
fi
nfile=$HOME/mywastebasket/$file
# ensure that $nfile does not exist
nn=0
while [ -e "$nfile" ]
do
# append a number and check again
nfile=${nfile}_$nn
nn=$((nn+1))
done
mv "$file" "$nfile"