-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concept: Pipelines and Command Lists #714
Conversation
``` | ||
|
||
The pipe symbol (`|`) connects the output of one command to the input of another. | ||
`cut` reads the output of `cat`, and `sort` reads the output of `cut`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to take a step back and mention how many commands read from STDIN (and/or a file) and write to STDOUT? Introduce STDIN/STDOUT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'll do a "sneak preview" of I/O, with a promise of more to come in a later concept.
Co-authored-by: Isaac Good <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though draft, still looks good to me.
806ff1d
to
253f794
Compare
@IsaacG can I get your opinion on the I/O blurb please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggested changes, but still approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still approved.
There is also one place where we have a sentence per line broken at a comma, I think that is kind of a nice thing to do for longer sentences anyway. But it is inconsistent, as there is one that is done this way but another that could benefit the same way.
Not a big deal, just a note here.
16eb3a0
to
f25361a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of changes proposed, and one thing to consider.
Sorry for missing that. It's been a hectic two weeks. The blurb looks good! Do you still want nitpick improvement suggestions? |
Always! |
@@ -0,0 +1,198 @@ | |||
# Pipelines and Command Lists | |||
|
|||
We have seen how to write simple commands, where a command is followed by arguments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the prior lesson?
# Pipelines and Command Lists | ||
|
||
We have seen how to write simple commands, where a command is followed by arguments. | ||
Now we will see how to make more complex commands by composing simple commands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"by combining simple commands"
Composing means writing. Composing simple commands gives you simple commands.
|
||
## Input and Output | ||
|
||
Before we start, a quick introduction to input/output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"to input and output (I/O or IO)"
|
||
Before we start, a quick introduction to input/output. | ||
|
||
Processes have "standard I/O channels". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I/O should be defined before being used.
Channels might be worth definig.
"Processes interact with other processes (or users) by transmitting data across channels. Data going into the process is input (such as a user typing numbers into a calculator) while data coming out of the process is output (such as the result of a calculation or an error message)."
* A process can consume _input_ on "stdin". | ||
* A process can emit _output_ on "stdout". | ||
* A process can emit _error output_ on "stderr". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expand those first. "on stand out (stdout)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a good place to explain how multiple, distinct channels (STDOUT and STDERR) can both write to the same destination (the terminal) then mention later how the pipe redirects one but not the other.
|
||
## Pipelines | ||
|
||
This is one of the "killer features" of shell programming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/This/Pipelines/
"This" references a prior idea. A new paragraph should generally not be attached to a prior idea.
## Pipelines | ||
|
||
This is one of the "killer features" of shell programming. | ||
Pipelines allow you create sophisticated transformations on a stream of text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/create/perform
cat /etc/passwd | cut -d : -f 1 | sort | ||
``` | ||
|
||
The pipe symbol (`|`) connects the output of one command to the input of another. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stderr was defined out "output" (error output) earlier. One might think the |
would redirect STDERR
|
||
A command list is a sequence of pipelines separated by `;` (or newline), `&&` or `||`. | ||
|
||
* `A; B` is a command list where `B` executes after `A` has completed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/executes/always executes/
#### Reading blocks of lines from a file | ||
|
||
Suppose you have a data file containing data about triangles, | ||
and a triangle is represented by three separate lines holding the sides of the triangle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line per sentence
No description provided.