You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No reasonable equivalent for bash's if foo="$(some command)" #158
then the if statement will actually conditionalize based on the exit status of $(some command). I don't see any way to get the equivalent functionality in fish. The fundamental problem is variable assignment in fish must be done via the set command, which overwrites $status, and so there is no reasonable way to capture the output of a command and its return value separately. The only unreasonable way I can think of looks like
set -l oldstatus
set -l foo (some command; set oldstatus $status)
This was fixed in #214; now you can write if set foo (somecommand) and, set will fail if either the subcommand failed, or if setting the variable itself failed.
Activity
ridiculousfish commentedon Mar 12, 2013
This was fixed in #214; now you can write
if set foo (somecommand)and, set will fail if either the subcommand failed, or if setting the variable itself failed.