> On Thu, Sep 23, 2010 at 04:38:42PM -0500, Michael Witten wrote:
>> This is also possible:
>>
>> [ -f "$file" ] && do_something
Note that this style is not compatible with set -e
Le 24/09/2010 00:35, Ken Irving a écrit :
> While we're talking about style... I prefer using 'test' rather than
> '[..]' as it seems to me to be more readable.
>
> Are there actual advantages for [] over test? I guess the former uses
> one less byte than the latter.
For longer conditions brackets are easier to "parse"; the reader has no
doubt where it ends.
By the way I wonder if this makes any difference to the actual parser.
On the other hand some people explain that long conditions are bad
practice anyway, and that you should write:
test x && test y || test z