Making Your Prompt More Informative

Setting a particular parameter is as simple as typing VARIABLE=value . This would set a parameter by the name VARIABLE with the value that you provide.

To see a list of the environment variables that are already set on your machine, type the following

$ env

Many prompts do not include the return code of the last command. Although such information is not completely necessary, it might help you see whether a previous command succeeded or failed. So, a simple, informative prompt that is easy to read can be set as follows (in the bash shell):

export PS1="-$?-(\u@\h) \w --> "

$? : this willgive you the return code wheather the previous command executed successfully

\w: This special sequence expands to your full current working directory. \n : can add this to the PS1 vairable ..... this takes you to the next line .

[ note: the export command sets a enviroment virable ]

you can also check inthe home dir of root ( ~ ) .bashrc file and make changes to the PS1 vairables there

--

No comments:

Other Articles

Enter your email address: