Understanding stdin
This will be a bit easier, since only one operator symbol is involved. Here’s the graphical representation:
Figure 4.2: How stdin works
For our example, we’ll briefly look at the tr
utility. (We’ll give tr
a more in-depth explanation in Chapter 7, Text Stream Filters-Part 2. For now, let’s just say that it’s a utility that translates things.) By default, tr
would take its stdin
from the keyboard.
One thing you can do is to type a text string in all lower-case, and have tr
echo it back to you in all upper-case. Hit the Enter key after you’ve typed the tr [:lower:] [:upper:]
command, and hit it again after you’ve typed your line of text. When the upper-case line comes up, hit Ctrl-d to exit tr
. It should look something like this:
[donnie@fedora ~]$ tr [:lower:] [:upper:]
i only want to type in all upper-case letters.
I ONLY WANT TO TYPE IN ALL UPPER-CASE LETTERS.
[donnie@fedora ~]$
If you...