Redirecting Standard Input
Start like this:
Part of learning the shell is losing your fear of making mistakes. The sooner you make your first 5000 mistakes, the better. What do these do?
cat
hello, world
hello, world
^Dcat
cat > FOO
hello, world
^Dcat FOO
hello, worldcat < FOO
cat copies the input that you type -- standard input, or stdin -- to the screen.
Next, redirect output to a file.
This puts the string "hello, world" into the file,
FOO
.You can check it by looking at the contents of
FOO
.Finally, use the command history and editing keys to recall command [2], change
the '>' to a '<', and to press a carriage return.
With '<' the arrowhead points from the file toward the command,
redirecting the contents of the file
FOO
into the command cat.Part of learning the shell is losing your fear of making mistakes. The sooner you make your first 5000 mistakes, the better. What do these do?
cat < FOO > BAR
< FOO > BAR cat
< cat > BAR
BAR < > cat
0 Comments:
Post a Comment
<< Home