I am learning c shell and i am trying to do this problem. This is the question
1) check that an argument was entered on the command line and that it is the name
of a directory file
2) if no argument was entered on the command line or the argument entered is not
the name of a directory file, then an error message should be output and the script
terminated
3) count the number of files (including files in sub-directories) which has only user
read, write and execute permissions and output relevant statements to tell the user
the number of files in this directory and its sub-directories that satisfy the above
criteria
This is what i have done so far:
#!/bin/csh
if ("$1" == "" ) then
echo a directory file name argument required
exit
endif
if (! (-d $1) ) then
echo $1 should be a directory
exit
I hope that what i have done covers point one but i dont know how to include the error message for point 2 nor the counting of files for point3 . I am pretty sure thought that for point 3 it uses the foreach statement.
Any Help.