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!

[ test operator for multiple filenames

Status
Not open for further replies.

gfunk123

IS-IT--Management
May 22, 2001
143
GB
i need to be able to write a ksh script like this

if fileX and fileY and fileZ exist then blah blah blah. Ive tried

if [ -f fileX -a -f fileY -a -f fileZ ]
then


.....but this does not seem to work

does anybody know the syntax for this

cheers
 
I belive you want to use && for AND or || for OR.

I think this may work, but you'll need to test it.

if [ -f fileX ] && [ -a -f fileY ] && [ -a -f fileZ ]
then



Robert Robert G. Jordan
Unix Sys Admin
Sleepy Hollow, Illinois U.S.A.

FREE Unix Scripts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top