Consider this brief conversation with fish:
while (echo d | mail) ; sleep 1 ; end
fish: Command substitutions not allowed
while (echo d | mail) ; sleep 1 ; end
^
how can I correct my while loop?
More generally: do I understand right that the problem is something like : the while CONDITION is a command, but fish only allows (command substitution)
for parameters to a command, not the command itself?
So I think my question for both if
and while
could be : how do I write a pipeline as the CONDITION?
This can be written simply as:
while echo d | mail; sleep 1; end
In fish, as in other shells, command substitutions takes the output of the inner command, and uses it as arguments to the outer command. The exit status is discarded, which is why fish disallows them as the condition in loops.