I think that would be better written as "should not".

The difference between these two commands is seen when command_A is
successful but command_B fails:

true; and false; or echo you will see this


and

if true
    false
else
    echo you will NOT see this
end




On Mon, Sep 18, 2017 at 6:33 AM, Mark Volkmann <r.mark.volkm...@gmail.com>
wrote:

>
> On Sep 17, 2017, at 9:53 PM, Kurtis Rader <kra...@skepticism.us> wrote:
>
> On Sun, Sep 17, 2017 at 6:24 PM, Mark Volkmann <r.mark.volkm...@gmail.com>
> wrote:
>
>> Is there a short list of fish commands that do not set the status
>> variable?
>>
>
> I can't think of any that aren't syntactical keywords like `end`. There
> are a handful which propagate the status of a command they preface (e.g.,
> "builtin"). You should assume that every command sets $status.
>
> Note that "and" and "or" are both commands that set $status and which are
> also syntactical keywords. The exit status of the command that they preface
> is propagated to $status. This means you cannot chain them like this:
>
>
> Thanks for the detailed reply Kurtis! In the previous sentence, did you
> mean to say "can" instead of "cannot"?
>
> command_A
> and command_B
> or command_C
>
> That's because if "command_B" returns a non-zero status then "command_C"
> will be run.
>
> The "set" command is special in that it deliberately propagates the status
> of any command substitution as its status. But will also set $status if
> invoked with invalid arguments.
>
> Others aren't technically commands just syntactical keywords: "and", "or",
> "builtin", "command", "begin", "case", "end", "else", "if", "for",
> "switch", "while", "continue", "break". The status of the commands that
> follow them is visible for the keywords which take a command (e.g.,
> "builtin"). However, even here there are exceptions such as for "if" and
> "while". Those, like "continue", which are not followed by a command
> obviously do not affect $status.
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
>


-- 
*Glenn Jackman*
Senior Software Developer

*Pythian - Love your data*
jack...@pythian.com
Tel: +1 613 565 8696 Ext. 1478
Mobile: +1 613 808 4984
www.pythian.com

-- 


--



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to