Skip to content

Commit fc5cc50

Browse files
committed
wc: read helper-3.txt via stdin to suppress filenames
Use input redirection in script-01.sh and script-02.sh so wc reads from stdin (e.g. `wc -w < ../helper-files/helper-3.txt` and `wc -l < ../helper-files/helper-3.txt`). This prevents wc from printing the filename and returns only the count.
1 parent cef15e2 commit fc5cc50

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

individual-shell-tools/wc/script-01.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -euo pipefail
55
# TODO: Write a command to output the number of words in the file helper-files/helper-3.txt.
66
# The output should include the number 19. The output should not include the number 92.
77

8-
wc -w ../helper-files/helper-3.txt
8+
wc -w < ../helper-files/helper-3.txt

individual-shell-tools/wc/script-02.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -euo pipefail
55
# TODO: Write a command to output the number of lines in the file helper-files/helper-3.txt.
66
# The output should include the number 3. The output should not include the number 19.
77

8-
wc -l ../helper-files/helper-3.txt
8+
wc -l < ../helper-files/helper-3.txt

0 commit comments

Comments
 (0)