Quote:
That will fail if $INPUT contains spaces or is empty.
[ ! -f "$INPUT" ] && die "File $INPUT does not exist!"
|
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.
__________________
Vivek Gite
Linux Evangelist

Be proud
RHEL user, and let the world know about your enterprise choices!
Join RedHat user group.

Always use
CODE tags for posting system output and commands!

Do you run a Linux? Let's face it,
you need help