Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can some one tell me what's wrong with my scripts

Status
Not open for further replies.

tusifx

Programmer
Apr 6, 2003
19
0
0
US
i'm trying to write a script that'll count all my files and directories that i have. everything seems to be fine untill it get to the 'foreach' loop. i really can't figur out what's wrong with it.

some one please give me few pointers.
---------------------------------------------------------
#!/bin/csh

echo ~
find ~ -type d | grep -v backup > dirlist
wc -l dirlist
cat dirlist
foreach name(`cat dirlist`)
echo inside directory $name:
echo `find $name -type d | wc -l` directories
echo `find $name -type f | wc -l` files
end
echo i have `find . -type f | wc -l` files

----------------------------------------------------------

Thanx
 
tusifx,

A blank space is needed between "$name" and the ":".

ZaSter
 
ah......thanx for your help....

this thing drives me crazy.....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top