diff --git a/SC2024.md b/SC2024.md index 0e0ebb6..f8f89bd 100644 --- a/SC2024.md +++ b/SC2024.md @@ -6,7 +6,7 @@ or "Use `sudo cat file | ..`" instead of `<` to read. ### Problematic code: -``` +```sh # Write to a file sudo echo 3 > /proc/sys/vm/drop_caches @@ -19,7 +19,7 @@ sudo wc -l < /etc/shadow ### Correct code: -``` +```sh # Write to a file echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null @@ -45,14 +45,14 @@ Note: there is nothing special about `tee`. It's just the simplest command that Truncating: -``` +```sh echo 'data' | sudo dd of=file echo 'data' | sudo sed 'w file' ``` -Appending: +Appending: -``` +```sh echo 'data' | sudo awk '{ print $0 >> "file" }' echo 'data' | sudo sh -c 'cat >> file' ```