mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 00:01:15 -03:00
Execute the conditions of if and while statements outside of their block
Variables set in if and while conditions are in the enclosing block, not
the if/while statement block. For example:
if set -l var (somecommand) ; end
echo $var
will now work as expected.
Fixes #4820. Fixes #1212.
This commit is contained in:
@@ -39,3 +39,13 @@ if false ; or true | false ; echo "failure5" ; end
|
||||
|
||||
logmsg Catch this corner case, which should produce an error
|
||||
if false ; or --help ; end
|
||||
|
||||
logmsg Loop control in conditions
|
||||
for i in 1 2 3
|
||||
while break; end
|
||||
echo $i
|
||||
end
|
||||
for i in 1 2 3
|
||||
while continue; end
|
||||
echo $i
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user