Hi all!
I'm new to shell scripting, and I need to do a diff between two dirs. One of them (dir_old) contains many files, and the other (dir_new) contains just a set of 8 files, all starting with MC and extension .CP .
The problem I have is that dir_old contains 12 files that start with MC and with no extension, so I need to check if the files in dir_new exist before using the diff.
This is what I have so far:
Code:
cd $dir_old
for name in MC*
do
if [test -e $dir_new$name.CP]; then
diff -s "$name" "$dir_new$name.CP" >> logfile
fi
done
All I get from this script is this list of errors:
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
testWhs[16]: [test: not found
I'm using ksh and according to the man cmd, the command exists, and I think I'm using it right, so I'm lost :-(
Thanks for the help!