I'm learning bash and have the following script
#!/bin/bash mv myfile.txt myfileBACKUP.txt echo "yo i love taylorswift and i like blink182 ok done">> myfile.txt mv myfileBACKUP.txt myfile.txt
the problem is that after I run script I still have myfileBACKUP.txt left and when I try to delete it I get error similar to this guy's
The file cannot be moved to the trash.
Basically im looking to write a script which backs up an original file, create a new file and do something with the new file, then restore the original file.
Any help on how to do that and / or why I'm getting this garbage file leftover?
file permission from ls -la (the bad files doesn't show up in ls)
-rwxrwxr-x 1 odroid odroid 147 Dec 23 02:08 autodownloadv2.sh -rw-rw-r-- 1 odroid odroid 45 Dec 23 02:59 myfile.txt
also the first time I run this myfile.txt doesn't exist so it throws an error I dont know if that has anything to do with this.