impossible to change PS1 via /etc/profile.d
Task Info (Flyspray) | |
---|---|
Opened By | Konstantin Shalygin (k0ste) |
Task ID | 73956 |
Type | Bug Report |
Project | Arch Linux |
Category | Packages: Core |
Version | None |
OS | All |
Opened | 2022-02-25 18:03:55 UTC |
Status | Assigned |
Assignee | Felix Yan (felixonmars) |
Assignee | Levente Polyak (anthraxx) |
Assignee | Giancarlo Razzolini (grazzolini) |
Details
Hi, currently is impossible to modify bash PS1 prompt for users dynamically via /etc/profile.d (for example via IaC's)
From profile manual:
[quote] All users who have the shell, sh(1), as their login command have the commands in these files executed as part of their login sequence.
/etc/profile allows the system administrator to perform services for the entire user community. Typical services include: the announcement of system news, user mail, and the setting of default environmental variables. [/quote]
How to reproduce:
- Put this script to /etc/profile.d/any.sh
[code] #!/bin/bash
source /etc/os-release
NC="\033[0m"
FOREGROUND="\033[38;1;36m\033[48;5;235m"
YELLOW="\033[1;33m"
echo -e "${FOREGROUND}Welcome to ${PRETTY_NAME} (uname -r)
{NC}\n"
export PS1="${YELLOW}[\u@\h \W]\$ ${NC}"
[/code]
- Run
export /etc/profile.d/any.sh
- Now your PS1 color is yellow
- Logout from your session, or open new screen/tmux session
- Now you see the welcome greeting, but your PS1 color is not yellow
Where this works as expected? At CentOS Stream, how CentOS bashrc looks like you can see here [1] I think Arch bashrc should be updated, current bashrc placed to repo 11 years ago
Thanks!