Computing.Net > Forums > Unix > C Shell Script Help

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

C Shell Script Help

Reply to Message Icon

Original Message
Name: The_Lone_Wolf
Date: August 17, 2005 at 11:14:22 Pacific
Subject: C Shell Script Help
OS: Microsoft XP professional
CPU/Ram: Pentium 4 512
Comment:

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.


Report Offensive Message For Removal








Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home



Results for: C Shell Script Help

C-shell script help
    Summary: Hi, I am very new to Unix (taken one week of class so far) and have been given an assignment that I find impossible to accomplish. It seems like a very advanced assignment. The assignment is as fo...
www.computing.net/answers/unix/cshell-script-help/6828.html

C Shell script help!
    Summary: I need help on writing 2 shell scripts: 1) Write a shell script, to be called `keep', that will take any number of file names as arguments. It should remove all files from the current directory...
www.computing.net/answers/unix/c-shell-script-help/3108.html

c shell script help PLEASE
    Summary: Please help me on two shell scripts: 1. the script simulates the ls -l command but prints only three columns of our choice. 2. the script makes a file out of the information in the etc/passwd. file u...
www.computing.net/answers/unix/c-shell-script-help-please/4355.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software