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
shfmt bug: &> is broken onto a new line, while >& isn't #991
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[/+]on 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.
Activity
[-]shellfmt bug: `&>` is broken onto a new line, while `>&` isn't[/-][+]shfmt bug: `&>` is broken onto a new line, while `>&` isn't[/+]mvdan commentedon Apr 22, 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".netrixken commentedon Jun 6, 2023
Just noticed today
if ping -c 1 $default_gateway_ip &>/dev/null; thenbecomes
Using https://marketplace.visualstudio.com/items?itemName=mkhl.shfmt
mvdan commentedon Jun 10, 2023
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
.bashextension or a shebang like#!/usr/bin/bash. More details in the commit above.syntax: treat &> as an error in POSIX mode