Updated SC2024 (markdown)

Eisuke Kawashima
2025-07-29 10:05:09 +09:00
parent e365ea5bc7
commit 7545a421e6

@@ -6,7 +6,7 @@ or "Use `sudo cat file | ..`" instead of `<` to read.
### Problematic code: ### Problematic code:
``` ```sh
# Write to a file # Write to a file
sudo echo 3 > /proc/sys/vm/drop_caches sudo echo 3 > /proc/sys/vm/drop_caches
@@ -19,7 +19,7 @@ sudo wc -l < /etc/shadow
### Correct code: ### Correct code:
``` ```sh
# Write to a file # Write to a file
echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null 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: Truncating:
``` ```sh
echo 'data' | sudo dd of=file echo 'data' | sudo dd of=file
echo 'data' | sudo sed 'w file' echo 'data' | sudo sed 'w file'
``` ```
Appending: Appending:
``` ```sh
echo 'data' | sudo awk '{ print $0 >> "file" }' echo 'data' | sudo awk '{ print $0 >> "file" }'
echo 'data' | sudo sh -c 'cat >> file' echo 'data' | sudo sh -c 'cat >> file'
``` ```