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

simple file testing won't work

Status
Not open for further replies.

jawon

Programmer
Feb 6, 2003
31
US
When I do a korn shell script...

if [-f filea]
then echo "it exists"
fi

I get...

[-f: not found

Seems straightforward, but what are the possible reasons for the error?
 
Put a space between the "[" and the "-f". The shell is seeing "[-f" as a single token.

Hope this helps.

 
Also put a space between [tt]filea[/tt] and the final [tt]][/tt].

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top