mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2227 (markdown)
@@ -27,14 +27,15 @@ This redirection may have been intended to apply only to a specific action like
|
|||||||
|
|
||||||
To perform a redirection per action, rewrite it with e.g. `-exec sh -c '...' _ {} \;`
|
To perform a redirection per action, rewrite it with e.g. `-exec sh -c '...' _ {} \;`
|
||||||
|
|
||||||
If the redirection is something like `> /dev/null` where you don't mind it applying to the whole `find` and not individual results, move the redirection to the end of command:
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
If the redirection is something like `> /dev/null` where you don't mind it applying to the whole `find` and not individual results, you can move the redirection to the end of command to make it clear to ShellCheck (and humans) that it's not meant per command:
|
||||||
|
|
||||||
find . -exec foo {} > /dev/null \; # Ambiguous syntax. Is it per -exec or not?
|
find . -exec foo {} > /dev/null \; # Ambiguous syntax. Is it per -exec or not?
|
||||||
find . -exec foo {} \; > /dev/null # Identical command with clear intent.
|
find . -exec foo {} \; > /dev/null # Identical command with clear intent.
|
||||||
|
|
||||||
### Exceptions:
|
There is no difference in behavior between the two.
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
### Related resources:
|
### Related resources:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user