From 7545a421e6791ec715ec62f62c20ffdc436030b4 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Tue, 29 Jul 2025 10:05:09 +0900 Subject: [PATCH] Updated SC2024 (markdown) --- SC2024.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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' ```