In lieu of that, here's how
In the simple case:
foo or bar
foo failed, fish moves on to the
or, which checks $status. This is similar to
foo if test $status -ne 0 bar end
This is all very easy and fine and dandy, there is however a special case. In
while conditions, the
or binds the command to the condition instead of going into the block:
if foo; or bar echo hello end
hello if foo succeds, and will also print hello if foo fails and the subsequent bar succeeds. If both foo and bar fail, it won't print.
This isn't 1000% clean, but the alternative of making
or just that simple shortcut is that you now need to write
if begin; foo; or bar; end
which is just annoying (and yes, that used to be the case up to fish ~2.3)
I'm assuming you meant the latter by "member of the block to execute", and so the answer is: Because it was annoying otherwise, so we changed it.
Because the other behavior might be "clean" from a theoretical standpoing, but also 100% useless:
if foo if test $status -ne 0 bar end echo hello end
Here, to get to the
foo would have to fail. But once it fails the if-block won't be entered anymore, so that
bar is unreachable! It can't be used! It's dead!
__fish_config_interactive, or some other heavy weight scripts, and ask yourself if you really find it all that elegant.
Damn, I really, really don't like that. Just a suggestion, but if it were me, I'd deprecate that usage of or in an if conditional with the semicolon preceding, and either A. Add documented syntax for 'or' used there without a semicolon, or B. move to || as the supported method. >.<
or without a semicolon is quite literally not possible and switching to just
|| won't happen.
whence -q seq || alias seq=jotquite doomed
rbenvfor example which I'd like to run
caffeinate rbenv, is there any better way than creating functions or binstubs for each of those?