This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Executable named "[.exe" in c:\cygwin\bin?


Am 12.12.2010 13:38, schrieb Daniel Colascione:
> On 12/12/10 4:34 AM, Matthias Andree wrote:
>>> [ -f file ] && echo is
>> you cannot run scripts containing this
>> under a "set -e" regime.
> 
> Yes you can.
> 
>     `-e'
>           Exit immediately if a simple command (*note Simple
>           Commands::) exits with a non-zero status, unless the command
>           that fails is part of the command list immediately following
>           a `while' or `until' keyword, part of the test in an `if'
>           statement, part of a `&&' or `||' list, or if the command's
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>           return status is being inverted using `!'.  A trap on `ERR',
>           if set, is executed before the shell exits.
> 

Yes, in theory.  In practice, I've seen too many shells goof this up.

The robust way to write the above under set -e is

if [ -f file ] ; then echo is ; fi

-- 
Matthias Andree

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]