Addressing each of your points in turn:
-bash-4.3
is the default prompt for you shell, which is bash. It shows the shell and its version.. The prompt is set by the environment variable PS1
. See Bash/Prompt customization.
user11
has a different value of $PS1
to user12. You can verify this by typing echo $PS1
for each user.
In ~/.bashrc
, for user12, add the line:
export PS1="${PWD}> "
Where to set PS1
The value of this environment variable can be set in a variety of places. The most common places are /etc/profile
, /etc/bashrc
, ~/.bash_profile
, and ~/.bashrc
.
From Setting the PS? Strings Permanently
Johan Kullstam (johan19@idt.net) writes:
The PS1
string should be set in .bashrc
. this is because
non-interactive bashes go out of their way to unset PS1
. the bash man
page tells how the presence or absence of PS1
is a good way of knowing
whether one is in an interactive vs non-interactive (i.e. script) bash
session.
The way I realized this is that startx
is a bash script. what this
means is, startx
will wipe out your prompt. when you set PS1
in
.profile
(or .bash_profile
), login at console, fire up X via startx
,
your PS1
gets nuked in the process leaving you with the default
prompt.
One workaround is to launch xterm
s and rxvt
s with the -ls
option to
force them to read .profile
, but any time a shell is called via a
non-interactive shell-script middleman PS1
is lost. system(3)
uses sh -c
which, if sh is bash
. will kill PS1
.
A better way is to place the PS1
definition in .bashrc
. This is read every time bash starts and is
where interactive things - e.g. PS1
should go.
Therefore it should be stressed that PS1=..blah..
should be in .bashrc
and not .profile
.
The bash prompt is an extensive subject, and too broad to discuss fully here. For further bash prompt customisation, see Bash Prompt HOWTO.