Fedora web server - Most environment variables are established for you by

Most environment variables are established for you by the system adminis- trator or perhaps by the shell itself. These variables are mostly read by pro- grams to gather information, and you don t need to change their values. However, you may want to alter the value of some environment variables. Forexample, in Table 14-1, the first entry, HISTSIZE, determines the number oflines of command-line history that are kept on file. You may have read thediscussion, earlier in this chapter, of re-executing a command from yesterday. (If not, refer to the section Accessing your command history. ) By setting ahigher number for HISTSIZE, you can save an even longer list of previouslyexecuted commands. Storing and retrieving variables valuesTo assign a value to a variable, you just use the variable name followed by anequals sign (=) followed by the value to store: MyVariable=MyValueTo retrieve the value represented by that variable, you need to precede thevariable name with a dollar sign ($). Look at a variable, created by the shell, that determines what your prompt looks like. This variable is named PS1. First, you view the value being held by PS1: echo $PS1You likely see something like the following line: [u@h W]$ Each of the characters preceded by a backslash represents a special instruc- tion to the shell to return specific information when the shell prompt is refer- enced. See Table 14-2 for examples of special slash-characters you can use incustomizing your prompt. Table 14-2Pieces of the PS1 PuzzleComponentResult!Prints the position of the command in your history list. #Prints the number of commands you have used during the current shell session. $Prints a $ for user accounts or a # for the superuser. dPrints the date in the following format: day month date. 286Part III:Getting Up to Speed with Linux

Leave a Reply