Prev | Current Page 190 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

???
I am 51 years old.
The shell interprets the arithmetic expression first (2008 - 1957), and then passes that information
to the echo command. The echo command displays the text, with the results of the arithmetic
(51) inserted.
Here??™s an example of the other form:
$ echo ???There are $(ls | wc -w) files in this directory.???
There are 14 files in this directory.
This lists the contents of the current directory (ls) and runs the word count command to count
the number of files found (wc -w). The resulting number (14 in this case) is echoed back with the
rest of the sentence shown.
Expanding Environment Variables
Environment variables that store information within the shell can be expanded using the dollar
sign ($) metacharacter. When you expand an environment variable on a command line, the value
of the variable is printed instead of the variable name itself, as follows:
$ ls -l $BASH
-rwxr-xr-x 1 root root 625516 Dec 5 11:13 /bin/bash
Using $BASH as an argument to ls -l causes a long listing of the bash command to be printed.
The following section discusses shell environment variables.
Creating Your Shell Environment
You can tune your shell to help you work more efficiently. Your prompt can provide pertinent
information each time you press Enter.


Pages:
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202