Mar 13, 2003 #1 jawon Programmer Joined Feb 6, 2003 Messages 31 Location 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?
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?
Mar 13, 2003 #2 SamBones Programmer Joined Aug 8, 2002 Messages 3,186 Location US Put a space between the "[" and the "-f". The shell is seeing "[-f" as a single token. Hope this helps. Upvote 0 Downvote
Put a space between the "[" and the "-f". The shell is seeing "[-f" as a single token. Hope this helps.
Mar 13, 2003 #3 SamBones Programmer Joined Aug 8, 2002 Messages 3,186 Location US Also put a space between [tt]filea[/tt] and the final [tt]][/tt]. Upvote 0 Downvote
Mar 14, 2003 #4 iribach Technical User Joined Oct 12, 2002 Messages 211 Location CH my way: [ -f filea ] && echo filea exists Upvote 0 Downvote