mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Added what I found on the error from stackoverflow
12
SC2024.md
12
SC2024.md
@@ -1,7 +1,13 @@
|
||||
# SC2024 sudo doesn't affect redirects. Use ..| sudo tee file
|
||||
|
||||
***
|
||||
## Problematic Code:
|
||||
|
||||
## Problematic code:
|
||||
`sudo ls -hal /root/ > /root/test.out`
|
||||
|
||||
`sudo pv $VAR1 > $VAR2`
|
||||
## Correct Code:
|
||||
|
||||
`sudo sh -c 'ls -hal /root/ > /root/test.out'`
|
||||
|
||||
## Source
|
||||
|
||||
[http://stackoverflow.com/a/82278](http://stackoverflow.com/a/82278)
|
Reference in New Issue
Block a user