On Sun, Dec 12, 2010 at 01:34:22PM +0100, Matthias Andree wrote:
>Am 12.12.2010 13:31, schrieb Csaba Raduly:
>
>> I guess something like this:
>> 
>> [ -f file ] && echo is
>
>True, but this is bad style.  Reason is you cannot run scripts containing this
>under a "set -e" regime.  However, most scripts should be doing that (and set 
>-u
>is also often advised), so that errors don't go unnoticed.

The above should work as expected with set -e.  In fact, you need to do
something like that if you've used "set -e".

Consider the variant:

#!/bin/sh -e
[ -f /fmp/fonexistent ] || echo nonexistent

It works just fine.

cgf

--
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

Reply via email to