C Shell Script

liunx

Guest
Hi back again this time needing help on shell scripts. I dunno if this is the right place to post this or if this is covered at all but i got a question to do with shell scripts and need some help. <br /><br />This is the question<br /><br />1) check that an argument was entered on the command line and that it is the name<br />of a directory file<br /><br />2) if no argument was entered on the command line or the argument entered is not<br />the name of a directory file, then an error message should be output and the script<br />terminated<br /><br />3) count the number of files (including files in sub-directories) which has only user<br />read, write and execute permissions and output relevant statements to tell the user<br />the number of files in this directory and its sub-directories that satisfy the above<br />criteria<br /><br />This is what i have done so far:<br /><br />#!/bin/csh<br />if ("$1" == "" ) then<br />echo a directory file name argument required<br />exit<br />endif<br />if (! (-d $1) ) then <br />echo $1 should be a directory<br />exit<br /><br />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.<br /><br />Any Help.
</div>
 
Top