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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

While loop syntax problem

Status
Not open for further replies.

czarj

Technical User
Apr 22, 2004
130
US
Hey everyone,

I have a small script that I want to parse through all the subdirectories within a given location and find all the files with a 'ttt' extension. However when I run the script I either get "Missing ]" or sometimes "permission denied." The files and the directories are owned by me, so I'm thinking this is a syntax problem...any help would be appreciated.

thanks

CzarJ

------------------------------------------------------
#!/usr/bin/csh

set Dir = `find $PWD -type d -print `;

while `$Dir` ;

do
cd $Dir
if
[ "`pwd`" = "${Dir}" ]
then
ls *.ttt
done

end
------------------------------------------------------
 
Don't know csh so much.
But why not simply do this ?
find $PWD -name '*.ttt' -print

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The reason for this script is because it will have to do other things later. Searching for the *.ttt files is just a test!
 
Doesn't have some directories space embedded in their name ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
While [ "`pwd`" = $DIR ];do
ls -al|grep ttt
done

--
| Mike Nixon
| Unix Admin
|
----------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top