Maybe one of you can help me figure out what's wrong with the following shell script I wrote earlier today, it's supposed to change directory to the 'ams' application subdirectory, and then print out the name of every file in this subdirectory, as well as display any and all lines within each file containing the word 'reference' (I try running this script from my home directory, but the script doesn't change the directory to the 'ams' subdirectory for some reason):
# shell script to list names of scripts containing the phrase 'reference'
$dirName = "/hpnpages/cgi-bin/applinks/ams"
cd $dirName
for fileName in `ls`
do
if (test -f $fileName)
then
print "Current file name is $fileName\n"
cat $fileName | grep 'reference'
print "\n"
fi
done
cd $HOME
# shell script to list names of scripts containing the phrase 'reference'
$dirName = "/hpnpages/cgi-bin/applinks/ams"
cd $dirName
for fileName in `ls`
do
if (test -f $fileName)
then
print "Current file name is $fileName\n"
cat $fileName | grep 'reference'
print "\n"
fi
done
cd $HOME