Pipes and Filters
-Last updated on 2024-04-12 | +
Last updated on 2024-09-26 | Edit this page
@@ -587,7 +587,7 @@OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -701,7 +701,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -751,7 +751,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -850,7 +850,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -913,7 +913,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -976,7 +976,7 @@
OUTPUT<
-
+
BASH
@@ -1024,7 +1024,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1137,7 +1137,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1168,9 +1168,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/05-loop.html b/05-loop.html
index ea6ed41a0..95d6117f9 100644
--- a/05-loop.html
+++ b/05-loop.html
@@ -541,7 +541,7 @@ Write your own loop
-
+
BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on
@@ -823,7 +823,7 @@ BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -1224,7 +1224,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -1272,7 +1272,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
diff --git a/07-find.html b/07-find.html
index f7c5f2db1..0fdb10c94 100644
--- a/07-find.html
+++ b/07-find.html
@@ -607,7 +607,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -705,7 +705,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -752,7 +752,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -1018,7 +1018,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -1093,7 +1093,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@ Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -3160,7 +3160,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -3274,7 +3274,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -3326,7 +3326,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -3431,7 +3431,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -3496,7 +3496,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -3559,7 +3559,7 @@
OUTPUT<
-
+
BASH
@@ -3609,7 +3609,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -3726,7 +3726,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
@@ -3760,9 +3760,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ Write your own loop
-
+
BASH
@@ -4064,7 +4066,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -4138,7 +4140,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -4181,7 +4183,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -4231,7 +4233,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -4693,7 +4695,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -4741,7 +4743,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
@@ -5813,7 +5815,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -5911,7 +5913,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -5958,7 +5960,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -6226,7 +6228,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -6301,7 +6303,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
diff --git a/index.html b/index.html
index 874151370..267898b7e 100644
--- a/index.html
+++ b/index.html
@@ -398,7 +398,7 @@
Windows
-
+
Computers with Windows operating systems do not automatically have a
Unix Shell program installed. In this lesson, we encourage you to use an
@@ -425,7 +425,7 @@
MacOS
-
+
For a Mac computer running macOS Mojave or earlier releases, the
default Unix Shell is Bash. For a Mac computer running macOS Catalina or
@@ -453,7 +453,7 @@
Linux
-
+
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html
index e31c5fd82..df620c24d 100644
--- a/instructor/04-pipefilter.html
+++ b/instructor/04-pipefilter.html
@@ -330,7 +330,7 @@
Pipes and Filters
- Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -589,7 +589,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -703,7 +703,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -753,7 +753,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -852,7 +852,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -915,7 +915,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -978,7 +978,7 @@
OUTPUT<
-
+
BASH
@@ -1026,7 +1026,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1139,7 +1139,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1170,9 +1170,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1245,7 +1247,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/instructor/05-loop.html b/instructor/05-loop.html
index b7213fd5c..3fa8da01e 100644
--- a/instructor/05-loop.html
+++ b/instructor/05-loop.html
@@ -543,7 +543,7 @@ Write your own loop
-
+
BASH
@@ -613,7 +613,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -685,7 +685,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -726,7 +726,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -774,7 +774,7 @@
BASH
Show me the solution
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -751,7 +751,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -850,7 +850,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -913,7 +913,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -976,7 +976,7 @@
OUTPUT<
-
+
BASH
@@ -1024,7 +1024,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1137,7 +1137,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1168,9 +1168,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/05-loop.html b/05-loop.html
index ea6ed41a0..95d6117f9 100644
--- a/05-loop.html
+++ b/05-loop.html
@@ -541,7 +541,7 @@ Write your own loop
-
+
BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on
@@ -823,7 +823,7 @@ BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -1224,7 +1224,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -1272,7 +1272,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
diff --git a/07-find.html b/07-find.html
index f7c5f2db1..0fdb10c94 100644
--- a/07-find.html
+++ b/07-find.html
@@ -607,7 +607,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -705,7 +705,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -752,7 +752,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -1018,7 +1018,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -1093,7 +1093,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@ Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -3160,7 +3160,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -3274,7 +3274,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -3326,7 +3326,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -3431,7 +3431,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -3496,7 +3496,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -3559,7 +3559,7 @@
OUTPUT<
-
+
BASH
@@ -3609,7 +3609,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -3726,7 +3726,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
@@ -3760,9 +3760,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ Write your own loop
-
+
BASH
@@ -4064,7 +4066,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -4138,7 +4140,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -4181,7 +4183,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -4231,7 +4233,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -4693,7 +4695,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -4741,7 +4743,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
@@ -5813,7 +5815,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -5911,7 +5913,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -5958,7 +5960,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -6226,7 +6228,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -6301,7 +6303,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
diff --git a/index.html b/index.html
index 874151370..267898b7e 100644
--- a/index.html
+++ b/index.html
@@ -398,7 +398,7 @@
Windows
-
+
Computers with Windows operating systems do not automatically have a
Unix Shell program installed. In this lesson, we encourage you to use an
@@ -425,7 +425,7 @@
MacOS
-
+
For a Mac computer running macOS Mojave or earlier releases, the
default Unix Shell is Bash. For a Mac computer running macOS Catalina or
@@ -453,7 +453,7 @@
Linux
-
+
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html
index e31c5fd82..df620c24d 100644
--- a/instructor/04-pipefilter.html
+++ b/instructor/04-pipefilter.html
@@ -330,7 +330,7 @@
Pipes and Filters
- Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -589,7 +589,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -703,7 +703,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -753,7 +753,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -852,7 +852,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -915,7 +915,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -978,7 +978,7 @@
OUTPUT<
-
+
BASH
@@ -1026,7 +1026,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1139,7 +1139,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1170,9 +1170,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1245,7 +1247,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/instructor/05-loop.html b/instructor/05-loop.html
index b7213fd5c..3fa8da01e 100644
--- a/instructor/05-loop.html
+++ b/instructor/05-loop.html
@@ -543,7 +543,7 @@ Write your own loop
-
+
BASH
@@ -613,7 +613,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -685,7 +685,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -726,7 +726,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -774,7 +774,7 @@
BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -751,7 +751,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -850,7 +850,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -913,7 +913,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -976,7 +976,7 @@
OUTPUT<
-
+
BASH
@@ -1024,7 +1024,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1137,7 +1137,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1168,9 +1168,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/05-loop.html b/05-loop.html
index ea6ed41a0..95d6117f9 100644
--- a/05-loop.html
+++ b/05-loop.html
@@ -541,7 +541,7 @@ Write your own loop
-
+
BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on
@@ -823,7 +823,7 @@ BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -1224,7 +1224,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -1272,7 +1272,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
diff --git a/07-find.html b/07-find.html
index f7c5f2db1..0fdb10c94 100644
--- a/07-find.html
+++ b/07-find.html
@@ -607,7 +607,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -705,7 +705,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -752,7 +752,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -1018,7 +1018,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -1093,7 +1093,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@ Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -3160,7 +3160,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -3274,7 +3274,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -3326,7 +3326,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -3431,7 +3431,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -3496,7 +3496,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -3559,7 +3559,7 @@
OUTPUT<
-
+
BASH
@@ -3609,7 +3609,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -3726,7 +3726,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
@@ -3760,9 +3760,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ Write your own loop
-
+
BASH
@@ -4064,7 +4066,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -4138,7 +4140,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -4181,7 +4183,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -4231,7 +4233,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -4693,7 +4695,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -4741,7 +4743,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
@@ -5813,7 +5815,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -5911,7 +5913,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -5958,7 +5960,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -6226,7 +6228,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -6301,7 +6303,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
diff --git a/index.html b/index.html
index 874151370..267898b7e 100644
--- a/index.html
+++ b/index.html
@@ -398,7 +398,7 @@
Windows
-
+
Computers with Windows operating systems do not automatically have a
Unix Shell program installed. In this lesson, we encourage you to use an
@@ -425,7 +425,7 @@
MacOS
-
+
For a Mac computer running macOS Mojave or earlier releases, the
default Unix Shell is Bash. For a Mac computer running macOS Catalina or
@@ -453,7 +453,7 @@
Linux
-
+
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html
index e31c5fd82..df620c24d 100644
--- a/instructor/04-pipefilter.html
+++ b/instructor/04-pipefilter.html
@@ -330,7 +330,7 @@
Pipes and Filters
- Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -589,7 +589,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -703,7 +703,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -753,7 +753,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -852,7 +852,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -915,7 +915,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -978,7 +978,7 @@
OUTPUT<
-
+
BASH
@@ -1026,7 +1026,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1139,7 +1139,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1170,9 +1170,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1245,7 +1247,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/instructor/05-loop.html b/instructor/05-loop.html
index b7213fd5c..3fa8da01e 100644
--- a/instructor/05-loop.html
+++ b/instructor/05-loop.html
@@ -543,7 +543,7 @@ Write your own loop
-
+
BASH
@@ -613,7 +613,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -685,7 +685,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -726,7 +726,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -774,7 +774,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -850,7 +850,7 @@
Piping Commands Together
-Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -913,7 +913,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -976,7 +976,7 @@
OUTPUT<
-
+
BASH
@@ -1024,7 +1024,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1137,7 +1137,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1168,9 +1168,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/05-loop.html b/05-loop.html
index ea6ed41a0..95d6117f9 100644
--- a/05-loop.html
+++ b/05-loop.html
@@ -541,7 +541,7 @@ Write your own loop
-
+
BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on
@@ -823,7 +823,7 @@ BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -1224,7 +1224,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -1272,7 +1272,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
diff --git a/07-find.html b/07-find.html
index f7c5f2db1..0fdb10c94 100644
--- a/07-find.html
+++ b/07-find.html
@@ -607,7 +607,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -705,7 +705,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -752,7 +752,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -1018,7 +1018,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -1093,7 +1093,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@ Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -3160,7 +3160,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -3274,7 +3274,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -3326,7 +3326,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -3431,7 +3431,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -3496,7 +3496,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -3559,7 +3559,7 @@
OUTPUT<
-
+
BASH
@@ -3609,7 +3609,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -3726,7 +3726,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
@@ -3760,9 +3760,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ Write your own loop
-
+
BASH
@@ -4064,7 +4066,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -4138,7 +4140,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -4181,7 +4183,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -4231,7 +4233,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -4693,7 +4695,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -4741,7 +4743,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
@@ -5813,7 +5815,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -5911,7 +5913,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -5958,7 +5960,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -6226,7 +6228,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -6301,7 +6303,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
diff --git a/index.html b/index.html
index 874151370..267898b7e 100644
--- a/index.html
+++ b/index.html
@@ -398,7 +398,7 @@
Windows
-
+
Computers with Windows operating systems do not automatically have a
Unix Shell program installed. In this lesson, we encourage you to use an
@@ -425,7 +425,7 @@
MacOS
-
+
For a Mac computer running macOS Mojave or earlier releases, the
default Unix Shell is Bash. For a Mac computer running macOS Catalina or
@@ -453,7 +453,7 @@
Linux
-
+
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html
index e31c5fd82..df620c24d 100644
--- a/instructor/04-pipefilter.html
+++ b/instructor/04-pipefilter.html
@@ -330,7 +330,7 @@
Pipes and Filters
- Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -589,7 +589,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -703,7 +703,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -753,7 +753,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -852,7 +852,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -915,7 +915,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -978,7 +978,7 @@
OUTPUT<
-
+
BASH
@@ -1026,7 +1026,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1139,7 +1139,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1170,9 +1170,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1245,7 +1247,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/instructor/05-loop.html b/instructor/05-loop.html
index b7213fd5c..3fa8da01e 100644
--- a/instructor/05-loop.html
+++ b/instructor/05-loop.html
@@ -543,7 +543,7 @@ Write your own loop
-
+
BASH
@@ -613,7 +613,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -685,7 +685,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -726,7 +726,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -774,7 +774,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -976,7 +976,7 @@
OUTPUT<
-
+
BASH
@@ -1024,7 +1024,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1137,7 +1137,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1168,9 +1168,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/05-loop.html b/05-loop.html
index ea6ed41a0..95d6117f9 100644
--- a/05-loop.html
+++ b/05-loop.html
@@ -541,7 +541,7 @@ Write your own loop
-
+
BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on
@@ -823,7 +823,7 @@ BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -1224,7 +1224,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -1272,7 +1272,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
diff --git a/07-find.html b/07-find.html
index f7c5f2db1..0fdb10c94 100644
--- a/07-find.html
+++ b/07-find.html
@@ -607,7 +607,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -705,7 +705,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -752,7 +752,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -1018,7 +1018,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -1093,7 +1093,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@ Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -3160,7 +3160,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -3274,7 +3274,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -3326,7 +3326,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -3431,7 +3431,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -3496,7 +3496,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -3559,7 +3559,7 @@
OUTPUT<
-
+
BASH
@@ -3609,7 +3609,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -3726,7 +3726,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
@@ -3760,9 +3760,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ Write your own loop
-
+
BASH
@@ -4064,7 +4066,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -4138,7 +4140,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -4181,7 +4183,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -4231,7 +4233,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -4693,7 +4695,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -4741,7 +4743,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
@@ -5813,7 +5815,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -5911,7 +5913,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -5958,7 +5960,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -6226,7 +6228,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -6301,7 +6303,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
diff --git a/index.html b/index.html
index 874151370..267898b7e 100644
--- a/index.html
+++ b/index.html
@@ -398,7 +398,7 @@
Windows
-
+
Computers with Windows operating systems do not automatically have a
Unix Shell program installed. In this lesson, we encourage you to use an
@@ -425,7 +425,7 @@
MacOS
-
+
For a Mac computer running macOS Mojave or earlier releases, the
default Unix Shell is Bash. For a Mac computer running macOS Catalina or
@@ -453,7 +453,7 @@
Linux
-
+
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html
index e31c5fd82..df620c24d 100644
--- a/instructor/04-pipefilter.html
+++ b/instructor/04-pipefilter.html
@@ -330,7 +330,7 @@
Pipes and Filters
- Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -589,7 +589,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -703,7 +703,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -753,7 +753,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -852,7 +852,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -915,7 +915,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -978,7 +978,7 @@
OUTPUT<
-
+
BASH
@@ -1026,7 +1026,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1139,7 +1139,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1170,9 +1170,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1245,7 +1247,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/instructor/05-loop.html b/instructor/05-loop.html
index b7213fd5c..3fa8da01e 100644
--- a/instructor/05-loop.html
+++ b/instructor/05-loop.html
@@ -543,7 +543,7 @@ Write your own loop
-
+
BASH
@@ -613,7 +613,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -685,7 +685,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -726,7 +726,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -774,7 +774,7 @@
BASH
Show me the solution
-
+
BASH
@@ -1024,7 +1024,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1137,7 +1137,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1168,9 +1168,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/05-loop.html b/05-loop.html
index ea6ed41a0..95d6117f9 100644
--- a/05-loop.html
+++ b/05-loop.html
@@ -541,7 +541,7 @@ Write your own loop
-
+
BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on
@@ -823,7 +823,7 @@ BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -1224,7 +1224,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -1272,7 +1272,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
diff --git a/07-find.html b/07-find.html
index f7c5f2db1..0fdb10c94 100644
--- a/07-find.html
+++ b/07-find.html
@@ -607,7 +607,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -705,7 +705,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -752,7 +752,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -1018,7 +1018,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -1093,7 +1093,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@ Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -3160,7 +3160,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -3274,7 +3274,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -3326,7 +3326,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -3431,7 +3431,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -3496,7 +3496,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -3559,7 +3559,7 @@
OUTPUT<
-
+
BASH
@@ -3609,7 +3609,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -3726,7 +3726,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
@@ -3760,9 +3760,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ Write your own loop
-
+
BASH
@@ -4064,7 +4066,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -4138,7 +4140,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -4181,7 +4183,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -4231,7 +4233,7 @@
BASH
Show me the solution
-
+
- The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-
+
3 is the correct answer. >>
appends to a file,
rather than overwriting it with the redirected output from a command.
@@ -4693,7 +4695,7 @@
BASH
Show me the solution
-
+
The second version is the one we want to run. This prints to screen
everything enclosed in the quote marks, expanding the loop variable name
@@ -4741,7 +4743,7 @@
BASH
Show me the solution
-
+
We have a nested loop, i.e. contained within another loop, so for
each species in the outer loop, the inner loop (the nested loop)
@@ -5813,7 +5815,7 @@
OUTPUT<
-
+
The correct answer is 3, because the -w
option looks
only for whole-word matches. The other options will also match ‘of’ when
@@ -5911,7 +5913,7 @@
BASH
Show me the solution
-
+
grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still
@@ -5958,7 +5960,7 @@
Little Women
-
+
for sis in Jo Meg Beth Amy
do
@@ -6226,7 +6228,7 @@ Matching and Subtracting
-
+
Option 1 is correct. Putting the match expression in quotes prevents
the shell expanding it, so it gets passed to the find
@@ -6301,7 +6303,7 @@
BASH
Show me the solution
-
+
- Find all files with a
.dat
extension recursively from
diff --git a/index.html b/index.html
index 874151370..267898b7e 100644
--- a/index.html
+++ b/index.html
@@ -398,7 +398,7 @@
Windows
-
+
Computers with Windows operating systems do not automatically have a
Unix Shell program installed. In this lesson, we encourage you to use an
@@ -425,7 +425,7 @@
MacOS
-
+
For a Mac computer running macOS Mojave or earlier releases, the
default Unix Shell is Bash. For a Mac computer running macOS Catalina or
@@ -453,7 +453,7 @@
Linux
-
+
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html
index e31c5fd82..df620c24d 100644
--- a/instructor/04-pipefilter.html
+++ b/instructor/04-pipefilter.html
@@ -330,7 +330,7 @@
Pipes and Filters
- Last updated on 2024-04-12 |
+
Last updated on 2024-09-26 |
Edit this page
@@ -589,7 +589,7 @@ OUTPUT<
-
+
The -n
option specifies a numerical rather than an
alphanumerical sort.
@@ -703,7 +703,7 @@ BASH
Show me the solution
-
+
In the first example with >
, the string ‘hello’ is
written to testfile01.txt
, but the file gets overwritten
@@ -753,7 +753,7 @@
BASH
Show me the solution
-
+
Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run
@@ -852,7 +852,7 @@
Piping Commands Together
-
+
Option 4 is the solution. The pipe character |
is used
to connect the output from one command to the input of another.
@@ -915,7 +915,7 @@
BASH
Show me the solution
-
+
The head
command extracts the first 5 lines from
animals.csv
. Then, the last 3 lines are extracted from the
@@ -978,7 +978,7 @@
OUTPUT<
-
+
BASH
@@ -1026,7 +1026,7 @@ OUTPUT<
-
+
Option 4. is the correct answer. If you have difficulty understanding
why, try running the commands, or sub-sections of the pipelines (make
@@ -1139,7 +1139,7 @@
Removing Unneeded Files
-
+
- This would remove
.txt
files with one-character
names
@@ -1170,9 +1170,11 @@ Key Points
-
sort
sorts its inputs.
-
-
head
displays the first 10 lines of its input.
+head
displays the first 10 lines of its input by
+default without additional arguments.
-
-
tail
displays the last 10 lines of its input.
+tail
displays the last 10 lines of its input by default
+without additional arguments.
-
command > [file]
redirects a command’s output to a
file (overwriting any existing content).
@@ -1245,7 +1247,7 @@ Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html",
"dateCreated": "2014-10-22",
- "dateModified": "2024-04-12",
+ "dateModified": "2024-09-26",
"datePublished": "2024-09-26"
}
diff --git a/instructor/05-loop.html b/instructor/05-loop.html
index b7213fd5c..3fa8da01e 100644
--- a/instructor/05-loop.html
+++ b/instructor/05-loop.html
@@ -543,7 +543,7 @@ Write your own loop
-
+
BASH
@@ -613,7 +613,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -685,7 +685,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -726,7 +726,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -774,7 +774,7 @@
BASH
Show me the solution
-
+
Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -1137,7 +1137,7 @@
Removing Unneeded Files
-- This would remove
.txt
files with one-character names
@@ -1168,9 +1168,11 @@ -
sort
sorts its inputs. -
-
head
displays the first 10 lines of its input.
+ -
-
tail
displays the last 10 lines of its input.
+ -
command > [file]
redirects a command’s output to a file (overwriting any existing content).
@@ -1243,7 +1245,7 @@ - The text from each file in turn gets written to the
alkanes.pdb
file. However, the file gets overwritten on @@ -823,7 +823,7 @@BASH
Show me the solution
-+3 is the correct answer.
>>
appends to a file, rather than overwriting it with the redirected output from a command. @@ -1224,7 +1224,7 @@BASH
Show me the solution
-+The second version is the one we want to run. This prints to screen everything enclosed in the quote marks, expanding the loop variable name @@ -1272,7 +1272,7 @@
BASH
Show me the solution
-+We have a nested loop, i.e. contained within another loop, so for each species in the outer loop, the inner loop (the nested loop) diff --git a/07-find.html b/07-find.html index f7c5f2db1..0fdb10c94 100644 --- a/07-find.html +++ b/07-find.html @@ -607,7 +607,7 @@
OUTPUT< -
+The correct answer is 3, because the
-w
option looks only for whole-word matches. The other options will also match ‘of’ when @@ -705,7 +705,7 @@BASH
Show me the solution
-+grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still @@ -752,7 +752,7 @@
Little Women
-+for sis in Jo Meg Beth Amy do @@ -1018,7 +1018,7 @@
Matching and Subtracting
-+Option 1 is correct. Putting the match expression in quotes prevents the shell expanding it, so it gets passed to the
find
@@ -1093,7 +1093,7 @@BASH
Show me the solution
-+- Find all files with a
.dat
extension recursively from the current directory
diff --git a/aio.html b/aio.html
index a53a28340..a513a852a 100644
--- a/aio.html
+++ b/aio.html
@@ -2901,7 +2901,7 @@
Key Points
Content from Pipes and Filters
-Last updated on 2024-04-12 | +
Last updated on 2024-09-26 | Edit this page
@@ -3160,7 +3160,7 @@OUTPUT< -
+The
@@ -3274,7 +3274,7 @@-n
option specifies a numerical rather than an alphanumerical sort.BASH
Show me the solution
-+In the first example with
>
, the string ‘hello’ is written totestfile01.txt
, but the file gets overwritten @@ -3326,7 +3326,7 @@BASH
Show me the solution
-+Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run @@ -3431,7 +3431,7 @@Piping Commands Together
-+Option 4 is the solution. The pipe character
|
is used to connect the output from one command to the input of another. @@ -3496,7 +3496,7 @@BASH
Show me the solution
-+The
head
command extracts the first 5 lines fromanimals.csv
. Then, the last 3 lines are extracted from the @@ -3559,7 +3559,7 @@OUTPUT< -
+BASH @@ -3609,7 +3609,7 @@
OUTPUT< -
+Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -3726,7 +3726,7 @@
Removing Unneeded Files
-+- This would remove
.txt
files with one-character @@ -3760,9 +3760,11 @@Key Points
-
sort
sorts its inputs. -
-
head
displays the first 10 lines of its input.
+ -
-
tail
displays the last 10 lines of its input.
+ -
command > [file]
redirects a command’s output to a file (overwriting any existing content).
@@ -3994,7 +3996,7 @@ - The text from each file in turn gets written to the
@@ -4286,7 +4288,7 @@
BASH
Show me the solution
-+3 is the correct answer.
>>
appends to a file, rather than overwriting it with the redirected output from a command. @@ -4693,7 +4695,7 @@BASH
Show me the solution
-+The second version is the one we want to run. This prints to screen everything enclosed in the quote marks, expanding the loop variable name @@ -4741,7 +4743,7 @@
BASH
Show me the solution
-+We have a nested loop, i.e. contained within another loop, so for each species in the outer loop, the inner loop (the nested loop) @@ -5813,7 +5815,7 @@
OUTPUT< -
+The correct answer is 3, because the
-w
option looks only for whole-word matches. The other options will also match ‘of’ when @@ -5911,7 +5913,7 @@BASH
Show me the solution
-+grep -w $1 -r $2 | cut -d : -f 2 | cut -d , -f 1,3 > $1.txt
Actually, you can swap the order of the two cut commands and it still @@ -5958,7 +5960,7 @@
Little Women
-+for sis in Jo Meg Beth Amy do @@ -6226,7 +6228,7 @@
Matching and Subtracting
-+Option 1 is correct. Putting the match expression in quotes prevents the shell expanding it, so it gets passed to the
find
@@ -6301,7 +6303,7 @@BASH
Show me the solution
-+- Find all files with a
.dat
extension recursively from diff --git a/index.html b/index.html index 874151370..267898b7e 100644 --- a/index.html +++ b/index.html @@ -398,7 +398,7 @@Windows
-+Computers with Windows operating systems do not automatically have a Unix Shell program installed. In this lesson, we encourage you to use an @@ -425,7 +425,7 @@
MacOS
-+For a Mac computer running macOS Mojave or earlier releases, the default Unix Shell is Bash. For a Mac computer running macOS Catalina or @@ -453,7 +453,7 @@
Linux
-+The default Unix Shell for Linux operating systems is usually Bash. On most versions of Linux, it is accessible by running the Gnome diff --git a/instructor/04-pipefilter.html b/instructor/04-pipefilter.html index e31c5fd82..df620c24d 100644 --- a/instructor/04-pipefilter.html +++ b/instructor/04-pipefilter.html @@ -330,7 +330,7 @@
Pipes and Filters
-Last updated on 2024-04-12 | +
Last updated on 2024-09-26 | Edit this page
@@ -589,7 +589,7 @@OUTPUT< -
+The
@@ -703,7 +703,7 @@-n
option specifies a numerical rather than an alphanumerical sort.BASH
Show me the solution
-+In the first example with
>
, the string ‘hello’ is written totestfile01.txt
, but the file gets overwritten @@ -753,7 +753,7 @@BASH
Show me the solution
-+Option 3 is correct. For option 1 to be correct we would only run the
head
command. For option 2 to be correct we would only run @@ -852,7 +852,7 @@Piping Commands Together
-+Option 4 is the solution. The pipe character
|
is used to connect the output from one command to the input of another. @@ -915,7 +915,7 @@BASH
Show me the solution
-+The
head
command extracts the first 5 lines fromanimals.csv
. Then, the last 3 lines are extracted from the @@ -978,7 +978,7 @@OUTPUT< -
+BASH @@ -1026,7 +1026,7 @@
OUTPUT< -
+Option 4. is the correct answer. If you have difficulty understanding why, try running the commands, or sub-sections of the pipelines (make @@ -1139,7 +1139,7 @@
Removing Unneeded Files
-+- This would remove
.txt
files with one-character names
@@ -1170,9 +1170,11 @@ -
sort
sorts its inputs. -
-
head
displays the first 10 lines of its input.
+ -
-
tail
displays the last 10 lines of its input.
+ -
command > [file]
redirects a command’s output to a file (overwriting any existing content).
@@ -1245,7 +1247,7 @@
Key Points
head
displays the first 10 lines of its input by +default without additional arguments.tail
displays the last 10 lines of its input by default +without additional arguments.Key Points
"url": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html", "identifier": "https://swcarpentry.github.io/shell-novice/instructor/04-pipefilter.html", "dateCreated": "2014-10-22", - "dateModified": "2024-04-12", + "dateModified": "2024-09-26", "datePublished": "2024-09-26" } diff --git a/instructor/05-loop.html b/instructor/05-loop.html index b7213fd5c..3fa8da01e 100644 --- a/instructor/05-loop.html +++ b/instructor/05-loop.html @@ -543,7 +543,7 @@Write your own loop
-+BASH @@ -613,7 +613,7 @@
BASH
Show me the solution
-+The first code block gives the same output on each iteration through the loop. Bash expands the wildcard
*.pdb
within the loop @@ -685,7 +685,7 @@BASH
Show me the solution
-+4 is the correct answer.
*
matches zero or more characters, so any file name starting with the letter c, followed by @@ -726,7 +726,7 @@BASH
Show me the solution
-+4 is the correct answer.
*
matches zero or more characters, so a file name with zero or more characters before a letter @@ -774,7 +774,7 @@BASH
Show me the solution
-+ - This would remove
- Find all files with a
head
displays the first 10 lines of its input by +default without additional arguments.tail
displays the last 10 lines of its input by default +without additional arguments.Write your own loop
-+BASH @@ -4064,7 +4066,7 @@
BASH
Show me the solution
-+The first code block gives the same output on each iteration through the loop. Bash expands the wildcard
*.pdb
within the loop @@ -4138,7 +4140,7 @@BASH
Show me the solution
-+4 is the correct answer.
*
matches zero or more characters, so any file name starting with the letter c, followed by @@ -4181,7 +4183,7 @@BASH
Show me the solution
-+4 is the correct answer.
*
matches zero or more characters, so a file name with zero or more characters before a letter @@ -4231,7 +4233,7 @@BASH
Show me the solution
-+ - Find all files with a
Key Points
head
displays the first 10 lines of its input by
+default without additional arguments.
tail
displays the last 10 lines of its input by default
+without additional arguments.
Key Points
"url": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html", "identifier": "https://swcarpentry.github.io/shell-novice/04-pipefilter.html", "dateCreated": "2014-10-22", - "dateModified": "2024-04-12", + "dateModified": "2024-09-26", "datePublished": "2024-09-26" } diff --git a/05-loop.html b/05-loop.html index ea6ed41a0..95d6117f9 100644 --- a/05-loop.html +++ b/05-loop.html @@ -541,7 +541,7 @@Write your own loop
-BASH
@@ -611,7 +611,7 @@ BASH
Show me the solution
-
+
The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
Show me the solution
-The first code block gives the same output on each iteration through
the loop. Bash expands the wildcard *.pdb
within the loop
@@ -683,7 +683,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so any file name starting with the letter c, followed by
@@ -724,7 +724,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@
BASH
Show me the solution
-
+
4 is the correct answer. *
matches zero or more
characters, so a file name with zero or more characters before a letter
@@ -772,7 +772,7 @@