-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Linux Essentials - Second Edition
By :

Another type of variable is assigned within scripts—for instance, such variables can be set from the output of a command. These variables are also identified by leading dollar signs, but they’re typically given names that at least begin with a letter, such as $Addr or $Name. (When values are assigned to variables, the dollar sign is omitted, as illustrated shortly.) You can then use these variables in conjunction with normal commands as if they were command parameters, but the value of the variable is passed to the command.
For instance, consider Listing 11.3, which checks to see if the computer’s router is up with the help of the ping utility. This script uses two variables. The first is $ip, which is extracted from the output of route using the grep, tr, and cut commands. When you’re assigning a value to a variable from the output of a command, that command should be enclosed in back-tick characters (`), which appear on the same key as the...
Change the font size
Change margin width
Change background colour