From 4c5cfe131fda945ad0ac89ce12af045d357cb891 Mon Sep 17 00:00:00 2001 From: koalaman Date: Thu, 11 Sep 2014 11:02:34 -0700 Subject: [PATCH] Updated SC2024 (markdown) --- SC2024.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) 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