I'm trying to match backup files in a script and then delete them. The backup files are the ones that have the tilde (~
) in them:
$ ls -al
drwxr-xr-x 3 jwalton jwalton 4096 Feb 18 09:00 .
drwxr-xr-x 5 jwalton jwalton 4096 Feb 18 08:54 ..
drwxr-xr-x 5 jwalton jwalton 4096 Feb 18 08:54 test-proj
-rwxr-xr-x 1 jwalton jwalton 664 Feb 18 09:00 clean.sh
-rwxr-xr-x 1 jwalton jwalton 628 Feb 18 08:59 clean.sh~
My clean script has the following test, but it looks like I'm doing something wrong:
if [ -e "*~" ]; then
rm "*~"
fi
What is the correct test to match a backed up file?