PDA

View Full Version : shell scripts?



Unregistered
05-05-2002, 08:19 PM
Hi ? i have a simple shell script program in Bourne Shell..
and would like someone to help me out here...

exitstatus=1

for i in `find $1 -group $2 -print`
do
if grep -s '^'$i'$' $oughttobe
then
exitstatus=0
else
if grep `ls -l $i | awk '{printf "%s",$3}'` $owners >>$names
then
echo $i >>$names
exitstatus=0
fi
fi
done
exit $exitstatus


Would someone be able to answer this question for me please?
How many command line arguments are expected and what do they each represent?

The script makes use of some other variables, eg, names, owners etc..:what would make these variables available to it..

if someone can answer these question for me, that would be much appreciated.

Cheers,
Syed

Deckard
05-06-2002, 05:43 AM
Originally posted by Unregistered
How many command line arguments are expected and what do they each represent?Two (a path and a group name). The script is looking for any files owned by a certain group ($2), and begins its search in the directory specified by $1. If a matching file is found, it greps the file to see if it contains the value of $oughttobe. It is not clear from this script what the value of $oughttobe ought to be (okay, bad pun).

If grep indicates the file contains whatever $oughttobe is, the name of the owner is appended to the file referred to as $names.


Originally posted by Unregistered
The script makes use of some other variables, eg, names, owners etc..:what would make these variables available to it..I'm going to guess that this script is meant to be called from another script, and that the variables are exported from the calling script.