please advice what is wrong with my code, ( I run this code on both OS linux and solaris )
I don't get the line from:
"file ended with .tmp"
example:
I need to verify if $FILE ended with .tmp or .old etc ...
code with the following example set the parameter: FILE=hosts.tmp
so I expected that grep will match the ".tmp" and because .tmp is the last characters
- the same for other TOKENS as ",TEMP" or "previos" or "-OLD" ...etc
code ( ksh script )
TOKENS=".tmp .old .previous -log temp ,TEMP -OLD previos"
FILE=hosts.tmp
for TOKEN in ` echo $TOKENS `
do
[[ ` echo $FILE | grep -c '$TOKEN$' ` -eq 1 ]] && echo "file ended with $TOKEN"
done