impossible to change PS1 via /etc/profile.d
| Task Info (Flyspray) | |
|--------------------------|------------------------------------------------------------------------------------------|
| <small>Opened By</small> | <small>[Konstantin Shalygin (k0ste)](https://bugs.archlinux.org/user/16979)</small> |
| <small>Task ID</small> | <small>[73956](https://bugs.archlinux.org/task/73956)</small> |
| <small>Type</small> | <small>Bug Report</small> |
| <small>Project</small> | <small>Arch Linux</small> |
| <small>Category</small> | <small>Packages: Core</small> |
| <small>Version</small> | <small>None</small> |
| <small>OS</small> | <small>All</small> |
| <small>Opened</small> | <small>2022-02-25 18:03:55 UTC</small> |
| <small>Status</small> | <small>Assigned</small> |
| <small>Assignee</small> | <small>[Felix Yan (felixonmars)](https://bugs.archlinux.org/user/11602)</small> |
| <small>Assignee</small> | <small>[Levente Polyak (anthraxx)](https://bugs.archlinux.org/user/17958)</small> |
| <small>Assignee</small> | <small>[Giancarlo Razzolini (grazzolini)](https://bugs.archlinux.org/user/20907)</small> |
### 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:
1. 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]
2. Run `export /etc/profile.d/any.sh`
3. Now your PS1 color is yellow
4. Logout from your session, or open new screen/tmux session
5. 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!
[1] https://pagure.io/setup/blob/master/f/bashrc
issue