mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC3021 (markdown)
@@ -1,2 +1,9 @@
|
|||||||
## In POSIX sh, `>&` is undefined.
|
## In POSIX sh, `>&` is undefined.
|
||||||
See similar warning [[SC3020]]
|
|
||||||
|
This warning was retracted after 0.8.0.
|
||||||
|
|
||||||
|
There are two forms of this operator: `>& fd`, and `>& filename`. The former is POSIX, and copies stdout to the given file descriptor or fails if it's not an integer. The latter is a bash specific extension meaning `> filename 2>&1`. Bash will interpret `>& $var` as one or the other depending on whether the value is an integer.
|
||||||
|
|
||||||
|
ShellCheck 0.8.0 and below was unable to differentiate and unintentionally treated both as `>& filename`, causing an invalid warning when the value was an integer.
|
||||||
|
|
||||||
|
If your script uses `>&` with an integer to copy a file descriptor, please ignore this warning. If it uses it to write both stdout and stderr to a filename, like `&>`, rewrite it explicitly to `> file 2>&1`.
|
Reference in New Issue
Block a user