ok what i need to do is
restore <filename> - This script should move the file called <filename> back to its original directory without requiring any further user input.
If a file of that name already exists at the restore location, the script prompts the user to select an appropriate alternative action.
heres what i have so far
Code:
#!/bin/sh
if [ "$1" == "-n" ]
then
cd /root/michael/trash
restore`grep "$2" /root/michael/store`
filename=`basename "$restore"`
echo "Where would you like to save the file?"
read location
location1=`readlink -f "$location"`
mv -i $filename "location1"/filename
else
cd /root/michael/trash
restore=`grep "$2" /root/michael/store`
filename=`basename "$restore"`
mv -i $filename "location1" $location
fi
so when i do restorn -n it ask me where i want to restore the file to, which works fine
and if i do restore without -n it should restore the file to the original place but when i do for example
restore test1.txt i get the error
Code:
mv: missing destination file operand after `'
any idea what i need to fix it