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!

directory

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hey,


I am trying to write a script that will ignore directories when directories are passed to it. Can anyone please help me.
 
"ignore directories when directories are passed to it"

???
Could you be more specific (& clearer!) :) One by one, the penguins steal my sanity. X-)

 
If my understanding of what you're asking is correct you could use the -d option of if to check whether the file is a directory (eg if [ -d <filename> ]. If it is, status ($?) will return a 0, otherwise it will be greater than 0. You can test $? if [ $? > 0 ] and take action (or no action) as appropriate. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top