Difference between revisions of "Changing bash prompt"

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search
Line 7: Line 7:
 
Sample outputs:
 
Sample outputs:
 
<pre>\u@\h:\w\$</pre>
 
<pre>\u@\h:\w\$</pre>
 
+
* For testing purpose set PS1 as follows and notice the changes:
 +
<source lang="bash">PS1='your wish is my command : '</source>
 +
Sample outputs:
 +
<pre>vivek@vivek-desktop:~$ PS1='your wish is my command : '
 +
your wish is my command : </pre>
  
 
[[Category:Variables and Quoting]][[Category:Commands]]
 
[[Category:Variables and Quoting]][[Category:Commands]]

Revision as of 10:54, 20 October 2009

← Using aliasesHomeSetting shell options →

  • Task: You need to customize your bash prompt by editing PS1 variable.
  • Display, your current prompt setting, enter:
echo $PS1

Sample outputs:

\u@\h:\w\$
  • For testing purpose set PS1 as follows and notice the changes:
PS1='your wish is my command : '

Sample outputs:

vivek@vivek-desktop:~$ PS1='your wish is my command : '
your wish is my command : 

← Using aliasesHomeSetting shell options →