Gentoo Forums
Gentoo Forums
Quick Search: in
How to change the prompt?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
andretti
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2007
Posts: 86

PostPosted: Mon Jun 25, 2007 9:48 am    Post subject: How to change the prompt? Reply with quote

Is $PS1 something like PROMPT in DOS? Anyone know where this was set and where can I find documentation about this since I can find it in man..

My prompt is getting too long as I go down the tree, and I want to make it shorter like the one root is having...
Back to top
View user's profile Send private message
forrestfunk81
Apprentice
Apprentice


Joined: 07 Feb 2006
Posts: 252
Location: münchen.de

PostPosted: Mon Jun 25, 2007 10:34 am    Post subject: Re: How to change the prompt? Reply with quote

andretti wrote:
Is $PS1 something like PROMPT in DOS?

Yes, it is something like this.

Quote:
Anyone know where this was set and where can I find documentation about this since I can find it in man..

Docu (first google hit searching for $PS1 ;-) )
I don't know where $PS1 is set, but you can overwrite the default settings by placing something like
Code:
 export PS1="(myBash) $PS1"

in your ~/.bashrc

greetz


$edit:
For system wide settings you can place it in /etc/bash/bashrc
Furthermore in /etc/bash/bashrc the prompt defaults are set.

Part of my /etc/bash/bashrc (think it's the default one)
Code:

if ${use_color} ; then
        # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
        if type -P dircolors >/dev/null ; then
                if [[ -f ~/.dir_colors ]] ; then
                        eval $(dircolors -b ~/.dir_colors)
                elif [[ -f /etc/DIR_COLORS ]] ; then
                        eval $(dircolors -b /etc/DIR_COLORS)
                fi
        fi

        if [[ ${EUID} == 0 ]] ; then
                PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
        else
                PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
        fi

        alias ls='ls --color=auto'
        alias grep='grep --colour=auto'
else
        if [[ ${EUID} == 0 ]] ; then
                # show root@ when we don't have colors
                PS1='\u@\h \W \$ '
        else
                PS1='\u@\h \w \$ '
        fi
fi

_________________
# cd /pub/
# more beer

http://outofctrl.eu/
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1251
Location: Netherlands

PostPosted: Mon Jun 25, 2007 1:33 pm    Post subject: Reply with quote

And to add the obvious: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/

Greetz
swimmer ;-)
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Durban, South Africa

PostPosted: Tue Jul 10, 2007 2:45 pm    Post subject: Reply with quote

You might also want to check out app-shells/bashish which is quite entertaining :)

-m
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum