1
0
mirror of https://github.com/koalaman/shellcheck.git synced 2025-03-12 12:35:25 -07:00

Updated SC2024 (markdown)

koalaman 2014-09-11 11:02:34 -07:00
parent b20b80949a
commit 4c5cfe131f

@ -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