51Chapter 2Running Commands from the Shell$ echo I (Web server address)

51Chapter 2Running Commands from the Shell$ echo I am $[2005 - 1957] years old. I am 48 years old. The shell interprets the arithmetic expression first (2005 - 1957) and then passesthat information to the echocommand. The echocommand displays the text, withthe results of the arithmetic (48) 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 VariablesEnvironment variables that store information within the shell can be expandedusing the dollar sign ($) metacharacter. When you expand an environment variableon a command line, the value of the variable is printed instead of the variable nameitself, as follows: $ ls -l $BASH-rwxr-xr-x 1 root root 625516 Dec 5 11:13 /bin/bashUsing $BASHas an argument to ls -lcauses a long listing of the bashcommand tobe printed. The following section discusses shell environment variables. Creating Your Shell EnvironmentYou can tune your shell to help you work more efficiently. Your prompt can providepertinent information each time you press Enter. You can set aliases to save yourkeystrokes and permanently set environment variables to suit your needs. To makeeach change occur when you start a shell, add this information to your shell config- uration files. Configuring Your ShellSeveral configuration files support how your shell behaves. Some of the files areexecuted for every user and every shell, whereas others are specific to the userwho creates the configuration file. Here are the files that are of interest to anyoneusing the bash shell in Linux:
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision mysql hosting services

Leave a Reply