WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: customized prompt?  (Read 3088 times)

Offline alu

  • Sr. Member
  • ****
  • Posts: 429
customized prompt?
« on: October 08, 2009, 03:23:53 AM »
i can't find the file where i can customize my prompt tc@box:~$ ; i would like to add date and info about the weight of the directory where i am; i tried with .profile and bashrc but nothing appens when i restart xvesa. does someone knows how i can customize the prompt?

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: customized prompt?
« Reply #1 on: October 08, 2009, 08:45:22 AM »
In TC, the PS1 variable is exported from .profile, which is a login file.  What this means is that the variable is set once, and then .profile is never read after that.  The result is that no changes to that file affect your environment unless you run the file again (or log out and log back in). So before starting x, run the command source .profile (shorthand: . .profile) (shorter-hand:. .pr<tab>)

Alternative: set PS1 in .ashrc, which is read for every ash shell (TC base doesn't use bash)

« Last Edit: October 08, 2009, 08:49:39 AM by mikshaw »

Offline alu

  • Sr. Member
  • ****
  • Posts: 429
Re: customized prompt?
« Reply #2 on: October 08, 2009, 03:07:32 PM »
thanks mikshaw, that did it.

Offline alu

  • Sr. Member
  • ****
  • Posts: 429
Re: customized prompt?
« Reply #3 on: October 08, 2009, 04:55:31 PM »
.... yes, i can change the prompt, but for some reason, date and time do not display:

#PS1='\d \t \u@\h:\w\$ '

do i do smthg wrong in the syntax?

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: customized prompt?
« Reply #4 on: October 09, 2009, 08:48:03 AM »
Your PS1 works in Bash, but seems to not work in Ash.  I haven't seen any documentation on this

Offline combo3

  • Full Member
  • ***
  • Posts: 148
Re: customized prompt?
« Reply #5 on: October 09, 2009, 10:16:04 AM »
Substitute `date` for \d

See here and here for format options.

ex.

PS1='`date "+%D"` \u@\h:\w\$ '

10/09/09 tc@box:~$
« Last Edit: October 09, 2009, 10:20:10 AM by combo3 »

Offline alu

  • Sr. Member
  • ****
  • Posts: 429
Re: customized prompt?
« Reply #6 on: October 10, 2009, 10:45:41 AM »
thanks combo3, it works perfectly now