mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-03-12 12:35:25 -07:00
Updated SC2024 (markdown)
parent
b20b80949a
commit
4c5cfe131f
22
SC2024.md
22
SC2024.md
@ -1,13 +1,9 @@
|
||||
# SC2024 sudo doesn't affect redirects. Use ..| sudo tee file
|
||||
|
||||
## Problematic Code:
|
||||
|
||||
`sudo ls -hal /root/ > /root/test.out`
|
||||
|
||||
## Correct Code:
|
||||
|
||||
`sudo sh -c 'ls -hal /root/ > /root/test.out'`
|
||||
|
||||
## Source
|
||||
|
||||
[http://stackoverflow.com/a/82278](http://stackoverflow.com/a/82278)
|
||||
# SC2024 sudo doesn't affect redirects. Use ..| sudo tee file
|
||||
|
||||
## Problematic Code:
|
||||
|
||||
sudo echo 'export FOO=bar' > /etc/profile
|
||||
|
||||
## Correct Code:
|
||||
|
||||
echo 'export FOO=bar' | sudo tee /etc/profile > /dev/null
|
||||
|
Loading…
x
Reference in New Issue
Block a user