This is the mail archive of the cygwin-apps@cygwin.com 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: generic-build-script maintainership


One thing I'd love to see in the generic-build-script, is:

set -e

instead of all the horrible && \ stuff. This would make it easier to indent,
reformat, add comments and greatly reduce the noise level. "set -e" works just
fine in both ash and bash. It can also be turned off and on in functions if
necessary.

Here's how it works:

Suppose you have:

-----------
#!/bin/sh

true
true
false
echo unreached...
------------

This prints "unreached...". Changint to:

-----------
#!/bin/sh

set -e

true
true
false
echo unreached...
-----------

Makes the script exit with status 1 at the "false" line.

It also works a bit like "use strict;" and -w in Perl, in that it forces
keeping track of commands in the script that exit with a non-zero status.

So in the artificial example above, if we don't want to exit at the false line,
something like:

false || true

works, and marks the command as possibly failing.

Anyway, just a pet peeve, feel free to ignore me :)

-- 
Rafael


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