
07-02-2009, 01:35 PM
|
|
Member
User
|
|
Join Date: May 2009
Posts: 78
Thanks: 0
Thanked 14 Times in 14 Posts
Rep Power: 2
|
|
Quote:
Originally Posted by nixcraft
How?
Code:
INPUT="this is a test.txt"
[ ! -f "$INPUT" ] && echo "No" || echo "Yes"
No
Code:
>"$INPUT"
[ ! -f "$INPUT" ] && echo "No" || echo "Yes"
Yes
And with empty
Code:
INPUT=""
[ ! -f "$INPUT" ] && echo "No" || echo "Yes"
No
Tested on GNU bash, version 3.2.39.
|
Now try it the way you wrote the script, without quotes around $INPUT.
It will give you error messages.
|