Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SC2227 should only apply when there is an additional command #3148

Open
srcshelton opened this issue Feb 17, 2025 · 0 comments
Open

SC2227 should only apply when there is an additional command #3148

srcshelton opened this issue Feb 17, 2025 · 0 comments

Comments

@srcshelton
Copy link

https://www.shellcheck.net/wiki/SC2227 states:

Redirection applies to the find command itself. Rewrite to work per action (or move to end).

Problematic code:
find . -name '*.ppm' -exec pnmtopng {} > {}.png ;

… but this warning triggers even with a command such as:

find "${log}" 2>/dev/null \                               
    -mindepth 4 \                                      
    -maxdepth 5 \                                      
    -name 'build.log' -or -name 'config.log' \         
    -type f \                                          
    -print

… where, since there is no additional command being executed, there doesn't appear to be any such ambiguity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant