SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've noticed an interesting thing that is not clear to me - why most of the variables from /etc/profile propagate all the way to interactive shells (which is what I would expect), but not the PS1? Where does it get overwritten from
Code:
PS1='\u@\h:\w\$ '
to
Code:
PS1='\s-\v\$ '
?
I actually experimented with exporting a TESTVAR that I defined in /etc/profile, which, as do other variables defined there, propagate to interactive shells for a regular user.
To get the full story, you will want to investigate the BASH documentation, the disto documentation (luckily, slack has GREAT documents), and do a little local investigation on your own machine. A variable can be set in a LOT of places, but the order and hierarchy will determine which value appears when the session opens.
BTW: the behavior is also different for different shells. The specific shell, and to some extent the version, will change the answers.
So my brute-force approach to work this out has not worked very well: I've grepped everything (i.e. the root recursively) for 'export.*PS1' (which is, I am aware, bash-specific), and the only hits that I had was in /etc/profile and in /etc/rc.d/rc.S (as well as documentation), but the one in rc.S seems to only be used in case of system repairs (and not general case), so I'm tempted to assume that it is irrelevant.
I do not have any local .profile or .bashrc that touch PS1.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.