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.  Something like:

function and_all
    for x in $argv
        if not $x ^/dev/null
            return $status
        end
    end
end

Then the script could use it like:

#!env fish
and_all \
false \
echo 'This will never get executed'

It's a bit ugly and slow, but it's more explicit than in Posix.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to