Interpret () in command position as subshell

This commit is contained in:
Johannes Altmanninger
2024-11-21 23:33:13 +01:00
parent 4a71ee1288
commit 0199583435
3 changed files with 40 additions and 44 deletions

View File

@@ -17,18 +17,6 @@ echo 'true | time false' | $fish 2>| string replace -r '(.*)' '<$1>'
# CHECK: < ^~~~~~~~~^>
echo '
FOO=BAR (true one)
(true two)
# more things
' | $fish 2>| string replace -r '(.*)' '<$1>'
# CHECK: <fish: command substitutions not allowed in command position. Try var=(your-cmd) $var ...>
# CHECK: <FOO=BAR (true one)>
# CHECK: < ^~~~~~~~~^>
$fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>'
# CHECK: <fish: Unexpected end of string, expecting ')'>
# CHECK: <echo "unfinished "(subshell>