Jump to content

How To Customize My Command Line Promt For My Working Directory?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
deprosun

deprosun

    Newbie

  • Members
  • Pip
  • 1 posts

$ PS1="[\d \t \u@\h:\w ] $ "


[Sat Jun 02 14:24:12 vivek@server:~ ] $


How to make my command prompt look like
Sat Jun 02 14:24:12 vivek@server:myDirectory!
while "myDirectory!" is a customized string that only shows when im in my home directory. New to this!

Thanks & Regards
:)

#2
ysangkok

ysangkok

    Newbie

  • Members
  • Pip
  • 2 posts
You can use PROMPT_COMMAND to store the variable part of your PS1 in an environment variable. Don't output directly from PROMPT_COMMAND as this page does. It is confusing and less flexible.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users