diff --git a/SC3021.md b/SC3021.md index 0969f58..af100e9 100644 --- a/SC3021.md +++ b/SC3021.md @@ -1,2 +1,9 @@ ## In POSIX sh, `>&` is undefined. -See similar warning [[SC3020]] \ No newline at end of file + +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`. \ No newline at end of file