Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: alu on October 08, 2009, 03:23:53 AM

Title: customized prompt?
Post by: alu 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?
Title: Re: customized prompt?
Post by: mikshaw 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)

Title: Re: customized prompt?
Post by: alu on October 08, 2009, 03:07:32 PM
thanks mikshaw, that did it.
Title: Re: customized prompt?
Post by: alu 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?
Title: Re: customized prompt?
Post by: mikshaw 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
Title: Re: customized prompt?
Post by: combo3 on October 09, 2009, 10:16:04 AM
Substitute `date` for \d

See here (http://www.oreillynet.com/linux/cmd/cmd.csp?path=d/date) and here (http://www.simplehelp.net/2008/12/18/the-linux-date-command/) for format options.

ex.

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

10/09/09 tc@box:~$
Title: Re: customized prompt?
Post by: alu on October 10, 2009, 10:45:41 AM
thanks combo3, it works perfectly now