I am seeing different results from the find command between being run manually on the command line vs run in a script.
If I run the following on the command line:
find . -name '*.txt' ! -name '*20120427.txt'
I get all the .txt files in a directory except for the ones with the date that I want to avoid.
But when I have this same line in a script with a variable to identify the date:
FDATE=`date +%Y%m%d`
find . -name '*.txt' ! -name '*${FDATE}.txt'
The script finds all the .txt files including the ones with the date I want to avoid.
The only difference between the 2 is that I am passing the FDATE variable in the script. Is there something obvious I am missing? I do not understand why the results are coming out different.