Skip to content

Commit ce69a15

Browse files
committed
markdown source builds
Auto-generated via `{sandpaper}` Source : c2c2fb4 Branch : main Author : Jesse Johnston <[email protected]> Time : 2025-11-24 12:17:19 +0000 Message : Merge pull request #290 from bkmgit/patch-5 Use clearer variable name
1 parent de46d4f commit ce69a15

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

04-loops.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ We have called the variable in this loop `filename` in order to make its purpose
101101
Complete the blanks in the for loop below to print the name, first line, and last line of each text file in the current directory.
102102

103103
```bash
104-
___ file in *.txt
104+
___ filename in *.txt
105105
__
106-
echo "_file"
106+
echo "_filename"
107107
head -n 1 _______
108108
____ __ _ _______
109109
____
@@ -114,11 +114,11 @@ ____
114114
## Solution
115115

116116
```bash
117-
for file in *.txt
117+
for filename in *.txt
118118
do
119-
echo "$file"
120-
head -n 1 "$file"
121-
tail -n 1 "$file"
119+
echo "$filename"
120+
head -n 1 "$filename"
121+
tail -n 1 "$filename"
122122
done
123123
```
124124

@@ -141,11 +141,11 @@ Alternatively, rather than running the loop above on the command line, you can s
141141
# This script loops through .txt files, returns the file name,
142142
# first line, and last line of the file
143143
144-
for file in *.txt
144+
for filename in *.txt
145145
do
146-
echo "$file"
147-
head -n 1 "$file"
148-
tail -n 1 "$file"
146+
echo "$filename"
147+
head -n 1 "$filename"
148+
tail -n 1 "$filename"
149149
done
150150
```
151151

files/my_first_bash_script.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
2-
# This script loops through .txt files, returns the
3-
# file name, first line, and last line of the file
2+
# This script loops through .txt files, returns the file name,
3+
# first line, and last line of the file
44

5-
for file in *.txt
5+
for filename in *.txt
66
do
7-
echo "$file"
8-
head -n 1 "$file"
9-
tail -n 1 "$file"
7+
echo "$filename"
8+
head -n 1 "$filename"
9+
tail -n 1 "$filename"
1010
done

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"episodes/01-intro-shell.md" "4248552de8d7fe3f30930e93acef8436" "site/built/01-intro-shell.md" "2023-05-08"
88
"episodes/02-navigating-the-filesystem.md" "a55e2785748efba647329295a246802c" "site/built/02-navigating-the-filesystem.md" "2024-05-02"
99
"episodes/03-working-with-files-and-folders.md" "f28760ce8c1c6e3b96c8b6ccacc55772" "site/built/03-working-with-files-and-folders.md" "2024-02-23"
10-
"episodes/04-loops.md" "a7efb91f8e706cf3a11505aeffdb8e11" "site/built/04-loops.md" "2025-11-24"
10+
"episodes/04-loops.md" "1b568bf2444aeefb0ad29a4def1815fc" "site/built/04-loops.md" "2025-11-24"
1111
"episodes/05-counting-mining.md" "8a1409e608d737dc37bb8057e9d6260b" "site/built/05-counting-mining.md" "2025-02-12"
1212
"episodes/06-free-text.md" "0189b30bfbfaaa9ab8e754834500b2f0" "site/built/06-free-text.md" "2024-06-05"
1313
"instructors/instructor-notes.md" "c317e03b34390725b50f49df1bf943b1" "site/built/instructor-notes.md" "2024-02-23"

0 commit comments

Comments
 (0)