Whenever I run this script the find part executes but the if statement causes this error:
./list_datasheets.csh: line 13: syntax error: unexpected end of file
this is the script:
find $1 -type d | while read -r dir
do
for f in ${dir}/*
do
echo ${f} | tr '[A-Z]' '[a-z]'
done
done
if ($2 == "both") then
echo 'bye'
else
echo 'hi'
endif
Try replacing the last line (
endif) withfi, which is the correct token to close anifstatement.Also, replace
($2 == "both")with the correct[ $2 == "both" ].Oh, and then, actually the
ifshould be written as:Note the quotes around
$2, the spaces after[and before]and the;before thethen.