diff --git a/SC2024.md b/SC2024.md index e75fc2c..8a25a32 100644 --- a/SC2024.md +++ b/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) \ No newline at end of file +# 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