Mailinglist Archive: opensuse-factory (607 mails)

< Previous Next >
[opensuse-factory] openSUSE and bash system profile loading issues
  • From: Hans-Peter Jansen <hpj@xxxxxxxxx>
  • Date: Wed, 26 Feb 2020 17:18:14 +0100
  • Message-id: <3056855.RThetIcDcY@xrated>

The idea is to throw a file into /etc/profiles.d/ and have everything
available in every users environment without any specific ~/.profile or
~/.bashrc tweaking.

Specifically, I want to define PS1, aliases and some functions.

Unfortunately it doesn't work as advertised.

Here's a subset of my trial (please ignore for now the way, I define the
PS1 colors here, it should work in most terminals):

cat > /etc/profile.d/ << EOF
# shell prompt
if [ -n "$BASH_VERSION" ]; then
set -P
set -p
if [ "$UID" = 0 ]; then

PS1='\[\033[1;32m\]\h\[\033[1;36m\]:\[\033[1;31m\]\w\[\033[0;33m\]#\[\033[0m\] '

export PS1

alias vi='vi -o'

psg () {
if [ $# -le 0 ]; then
ps auxww | less
ps auxww | egrep "$@" | grep -v grep

export repo=/etc/zypp/repos.d

In theory, these should be available in every users environment.

$repo is, the rest is not.

After "su - $USER" or login via ssh all is well?!? Puzzled.

So, there seems to be some environment tidying happen behind the scenes.
Of course, I studied /etc/profile, /etc/bash.bashrc, and I can source this
from ~/.bashrc. It will also not work, when sourced from ~/.profile.

It might be, that PS1 is redefined from /etc/bash.bashrc, but why does
it work from su - $USER or ssh then? psg() most definitely isn't redefined
anywhere else.

Anybody out there, who can shed some light into this issue would be much

Thanks in advance,

To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >