diff --git a/04-loops.md b/04-loops.md index fef6c29e..05a0fb38 100644 --- a/04-loops.md +++ b/04-loops.md @@ -138,12 +138,13 @@ Alternatively, rather than running the loop above on the command line, you can s ``` #!/bin/bash -# This script loops through .txt files, returns the file name, first line, and last line of the file +# This script loops through .txt files, returns the file name, +# first line, and last line of the file for file in *.txt do - echo $file - head -n 1 $file - tail -n 1 $file + echo "$file" + head -n 1 "$file" + tail -n 1 "$file" done ``` diff --git a/files/my_first_bash_script.sh b/files/my_first_bash_script.sh index 4cd0315f..be0891d7 100644 --- a/files/my_first_bash_script.sh +++ b/files/my_first_bash_script.sh @@ -1,8 +1,10 @@ #!/bin/bash +# This script loops through .txt files, returns the +# file name, first line, and last line of the file -for filename in *.txt +for file in *.txt do - echo $filename - head -n 5 $filename - tail -n 5 $filename -done \ No newline at end of file + echo "$file" + head -n 1 "$file" + tail -n 1 "$file" +done diff --git a/md5sum.txt b/md5sum.txt index 3e7f205d..c0e9f809 100644 --- a/md5sum.txt +++ b/md5sum.txt @@ -7,7 +7,7 @@ "episodes/01-intro-shell.md" "4248552de8d7fe3f30930e93acef8436" "site/built/01-intro-shell.md" "2023-05-08" "episodes/02-navigating-the-filesystem.md" "c85f3b8108023b4da52d70fce13f2c43" "site/built/02-navigating-the-filesystem.md" "2024-02-23" "episodes/03-working-with-files-and-folders.md" "f28760ce8c1c6e3b96c8b6ccacc55772" "site/built/03-working-with-files-and-folders.md" "2024-02-23" -"episodes/04-loops.md" "ef86d9f8b71733dea97b44a886391bdd" "site/built/04-loops.md" "2024-02-23" +"episodes/04-loops.md" "85f66d92cc6fc1a25b0214c0d108f892" "site/built/04-loops.md" "2024-04-03" "episodes/05-counting-mining.md" "f61fde3e769614d41d8b22e09f38d1e7" "site/built/05-counting-mining.md" "2024-02-23" "episodes/06-free-text.md" "143b9518631bcf5b114d1f432e5a9c25" "site/built/06-free-text.md" "2023-05-08" "instructors/instructor-notes.md" "c317e03b34390725b50f49df1bf943b1" "site/built/instructor-notes.md" "2024-02-23"