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
When shfmt sees a &>, it is broken onto a new line:
{ echo "foo" } &>/dev/null || {
echo "bar"
}
Becomes:
{ echo "foo" } &
>/dev/null || {
echo "bar"
}
The transformation also breaks the code.
If you switch &> with >& this does not happen.
The text was updated successfully, but these errors were encountered:
tandy-1000
changed the title
shellfmt bug: &> is broken onto a new line, while >& isn't
shfmt bug: &> is broken onto a new line, while >& isn't
Apr 17, 2023
What did you run exactly?. It's likely that you're trying to use POSIX mode when &> is bash syntax. Unfortunately, &> is also valid POSIX syntax; it just parses as & >, i.e. "background command then start a redirection".
The "fix" above is to give a helpful error, since I suspect that both of you were using POSIX mode to try to parse Bash syntax. You should be using the Bash mode, which should kick in automatically if your shell script has a .bash extension or a shebang like #!/usr/bin/bash. More details in the commit above.
When shfmt sees a
&>
, it is broken onto a new line:Becomes:
The transformation also breaks the code.
If you switch
&>
with>&
this does not happen.The text was updated successfully, but these errors were encountered: