From d069913bd158d42ae682f436aa0e6822bdba598b Mon Sep 17 00:00:00 2001 From: Todd Walton Date: Wed, 9 Dec 2020 12:47:38 -0500 Subject: [PATCH] note an exception where warning is invalid --- SC2210.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SC2210.md b/SC2210.md index 5339c74..606dc4d 100644 --- a/SC2210.md +++ b/SC2210.md @@ -29,6 +29,8 @@ This is not likely to be intentional. The most common causes are: 1. Trying similarly to compare command output, as in `grep -c foo file > 100` instead of `[ "$(grep -c foo file)" -gt 100 ]` 1. Malformed FD operations, such as writing `1>2` instead of `1>&2`. +If you do want to create a file named `4`, you can quote it to silence shellcheck and make it more clear to humans that it's not supposed to be taken numerically. + ### Exceptions: -None. If you do want to create a file named `4`, you can quote it to silence shellcheck and make it more clear to humans that it's not supposed to be taken numerically. \ No newline at end of file +If you use the `&>` form of redirection, as in `foo > /dev/null 2&>1`, it will trigger this warning. You can safely ignore this warning if that is what triggered it, or change your redirection operator to the semantically preferable `>&`. \ No newline at end of file