On Fri, Jan 21, 2011 at 03:12:23PM +0000, Nicholas Clark wrote:
> $ make -f 'This file does not exist'
> make: This file does not exist: No such file or directory
> make: *** No rule to make target `This file does not exist'.  Stop.
> $ echo $?
> 2
> 
> 
> $ sed -f 'This file does not exist'
> sed: couldn't open file This file does not exist: No such file or directory
> $ echo $?
> 4
> 
> 
> $ awk -f 'This file does not exist'
> awk: cannot open This file does not exist (No such file or directory)
> $ echo $?
> 2
> 
> 
> $ scons -f 'This file does not exist'
> scons: Reading SConscript files ...
> 
> scons: warning: Ignoring missing SConscript 'This file does not exist'
> File "/usr/bin/scons", line 161, in <module>
> scons: done reading SConscript files.
> scons: Building targets ...
> scons: `.' is up to date.
> scons: done building targets.
> $ echo $?
> 0
> 
> Every other utility that I'm aware of, if you tell it "open this file", will
> treat it as an error condition if said file does not exist.

ant, for instance, wants to be absolutely sure you know it doesn't
exist:

$ ant -f 'This file does not exist'
Buildfile: This file does not exist does not exist!
Build failed

OK, so the error message could be better, but even ant manages to its
exit code to something nonzero:

$ echo $?
1

I suppose it's too much to ask for programs to return the *same* error
code (ENOENT comes to mind) when a file doesn't exist.

Walt

Reply via email to