On Sat, Jun 28, 2008 at 06:21:44PM -0400, Philip Ganchev wrote:
On Thu, Jun 26, 2008 at 1:45 AM, Dwayne C. Litzenberger <[EMAIL PROTECTED]> 
wrote:
In POSIX shells (including bash), you can do something like this:

 #!/bin/sh
 set -e
 false     # The shell will exit with a non-zero status here
 echo 'This will never get executed'

Is anything similar to the "set -e" at the top of the script possible in a
fish script?

Not as far as I know.  You can use the "and" built-in inside the script:

#!env fish
echo blah
and false
and echo 'This will never get executed'

Or maybe you can write a function that does that.
[snip]

Ugh. Shouldn't errors be first-class in a shell? Most people write shell scripts assuming that all the commands will succeed. If something fails unexpectedly, you almost certainly want the script to stop immediately, rather than continuing on with essentially undefined behaviour.

To me, a "friendly" interface is one that doesn't violate people's expectations. For example, if I do this:

    set h (hostname -f | perl -p -e 'tr/A-Z/a-z/')
    echo $h > /etc/mailname

I shouldn't end up with an empty /etc/mailname just because perl wasn't installed in my PATH.

--
Dwayne C. Litzenberger <[EMAIL PROTECTED]>
 Key-signing key   - 19E1 1FE8 B3CF F273 ED17  4A24 928C EC13 39C2 5CF7
 Annual key (2008) - 4B2A FD82 FC7D 9E38 38D9  179F 1C11 B877 E780 4B45

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to