Okay.  I think I understand.  I'll try to give some advice.

The command 'exit' does exit the script or shell.  If you are inside a 
function, 'return' will exit the function not the whole shell.

If you want to preserve the error code value, something like this will do:

function foo
    ls  # this is the command that might fail
    set error_code $status
    if test 0 -ne $error_code 
        echo call_error_handler
        return $error_code
    end
end

If you don't need to preserve the error code, but only care about success or 
failure, you can simplify:

ls || begin
    echo call_error_handler
    false
end


_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to