4 ms·
The equivalent to || and && are the commands "or" and "and.": $cmd1 && $cmd2 || $cmd3 becomes $cmd1; and $cmd2; or $cmd3; i.e., they're just commands that i
by sagarm 13y ago
The equivalent to || and && are the commands "or" and "and.":
$cmd1 && $cmd2 || $cmd3
becomes
$cmd1; and $cmd2; or $cmd3;
i.e., they're just commands that inspect $status and run their arguments.
- Someone 13y agoIs that truly equivalent? Consider: $cmd1 || $cmd2 `$cmd3` vs $cmd1; or $cmd2 `$cmd3` If 'or' is 'just a command', I would think the shell would evaluate $cmd3 before calling $cmd2. Or are 'and' and 'or' built-ins that are similar to Lisp special forms/Forth immediate words? Edit: decided I wasn't that lazy today, and looked it up in the documentation. "and" and "or" are built-ins (http://fishshell.com/docs/2.0/commands.html#and http://fishshell.com/docs/2.0/commands.html#and, http://fishshell.com/docs/2.0/commands.html#or http://fishshell.com/docs/2.0/commands.html#or)