PDA

View Full Version : After logging -bash-3.1# is displayed



micko_escalade
4th July 2007, 09:58 AM
Hi all!

In FC4 after I would login it would say [root@myhost ~]#
now in FC6 I get -bash-3.1#
how do I change it to root@myhostname ?

Any help is appreciated!

sairam
4th July 2007, 10:05 AM
write this your .bashrc

PS1="[\u@\h \W]#"

Hope this helps.

micko_escalade
4th July 2007, 10:16 AM
Thanks for the reply!
I have .bashrc located in two places


-bash-3.1# locate .bashrc
/etc/skel/.bashrc
/home/micko_escalade/.bashrc
-bash-3.1#

both of them have this content

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions

where do I add PS1="[\u@\h \W]#"

giulix
4th July 2007, 10:38 AM
To /home/marinko/.bashrc if you want it to apply to user marinko only; to /etc/skel/.bashrc if you want it to apply to all new users. Actually there's a third bashrc in /etc: if you amend this file, it will apply to all users on the system, old and new

micko_escalade
4th July 2007, 10:45 AM
Adding PS1="[\u@\h \W]#"
to /etc/skel/.bashrc didn't help

# .bashrc
PS1="[\u@\h \W]#"
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions

only file in /etc that starts with . is .pwd.lock I can't see .bashrc

giulix
4th July 2007, 10:47 AM
The bashrc in /etc does not start with a dot (.)


Adding PS1="[\u@\h \W]#"
to /etc/skel/.bashrc didn't help


That is because it applies only to newly created users of the system (not retroactive), as I said

micko_escalade
4th July 2007, 08:11 PM
Ok, I found bashrc in /etc
with the bellow content in it
adding PS1="[\u@\h \W]#" to either bottom or top doesn't change -bash-3.1#
any other suggestions?

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# By default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi

if ! shopt -q login_shell ; then # We're not a login shell
# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
unset pathmunge
fi
# vim:ts=4:sw=4

sairam
5th July 2007, 05:34 AM
try typing the below on the prompt. Are you able to get a prompt or not ?

PS1="[\u@\h \W]#"

and also try this at the bash prompt

source /etc/bashrc

micko_escalade
5th July 2007, 07:11 AM
Thanks sairam!
Both suggestions work great in the prompt, how do I get that after every reboot without manually typing it?