From 8d40e7012ae454e7dc9fb2b6d4e81fa7672cd907 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Tue, 29 Jul 2025 10:13:06 +0900 Subject: [PATCH] Updated SC2012 (markdown) --- SC2012.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SC2012.md b/SC2012.md index e9e1d9c..224b7fa 100644 --- a/SC2012.md +++ b/SC2012.md @@ -5,6 +5,7 @@ ```sh ls -l | grep " $USER " | grep '\.txt$' ``` + ```sh NUMGZ="$(ls -l *.gz | wc -l)" ``` @@ -14,10 +15,12 @@ NUMGZ="$(ls -l *.gz | wc -l)" ```sh find ./*.txt -user "$USER" # Using the names of the files ``` + ```sh gz_files=(*.gz) numgz=${#gz_files[@]} # Sometimes, you just need a count -```` +``` + ### Rationale: `ls` is only intended for human consumption: it has a loose, non-standard format and may "clean up" filenames to make output easier to read.