I'm trying to write a shell scrip to move a file to a a different location when it's found. And when it's not found to move a file from that different location to its location. This is basically my first try at writing shell scripts so be easy on me.
#!/bin/bash
FILE=/usr/lib/mozilla/plugins/libfreshwrapper.so;
if [ -f $FILE ];
then
echo "File $FILE exists"
echo "moving $FILE to home"
mv -f $File /home/jon/temporary
else
echo "File $FILE does not exists"
echo "moving file back"
mv -f /home/jon/temporary/libfreshwrapper.so /usr/lib/mozilla/plugins
echo "done!"
fi
this is my problem.
File /usr/lib/mozilla/plugins/libfreshwrapper.so exists
moving /usr/lib/mozilla/plugins/libfreshwrapper.so to home
mv: missing destination file operand after ‘/home/jon/temporary’
You need to change the line
mv -f $File /home/jon/temporary
(Ln 9)to
mv -f $FILE /home/jon/temporary
You declared it in capitals.