Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
command prompt always just say bash-2.05a$
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
slimbim
n00b
n00b


Joined: 14 Aug 2002
Posts: 29

PostPosted: Wed Aug 21, 2002 3:48 am    Post subject: command prompt always just say bash-2.05a$ Reply with quote

In KDE, or Gnome, or enlightenment, basically in any command prompt or shell window, the prompt is always just bash-2.05a$.
How do I make it so that it will show something like name@domain home$ or something so that I know which directory I am currently in?

thank you!
Back to top
View user's profile Send private message
gfunkmonk
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jul 2002
Posts: 129
Location: Freelandville, IN

PostPosted: Wed Aug 21, 2002 3:51 am    Post subject: Reply with quote

try running it with the -ls option

like

xterm -ls
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Aug 21, 2002 3:59 am    Post subject: Reply with quote

  • There's a section on prompts in the bash manual, available with "man bash"
  • Check out this thread, which came up doing a forum search for "bash and prompt" in the Documentation, Tips & Tricks forum.

_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
slimbim
n00b
n00b


Joined: 14 Aug 2002
Posts: 29

PostPosted: Wed Aug 21, 2002 4:02 am    Post subject: Reply with quote

that kind of works. If I open up xterm in Enlightenment, like
right-click --> User applications --> xterm, it will be just bash-2.05a$, but if I do xterm -ls within that first xterm, the new second xterm will be the way I want, with the directory and stuff.

Is there a way to set so that the first xterm that I will open from enlightenment or any window manager will be this way?

thank you!
Back to top
View user's profile Send private message
slimbim
n00b
n00b


Joined: 14 Aug 2002
Posts: 29

PostPosted: Wed Aug 21, 2002 4:04 am    Post subject: Reply with quote

oh ok. thank you rac and gfunkmonk.

rac, sorry that I seem a little annoying or not trying. I will not post from now on unless I've done everything to find out on my own.

thanks!
Back to top
View user's profile Send private message
Logik
n00b
n00b


Joined: 15 Aug 2002
Posts: 9
Location: Michigan

PostPosted: Wed Aug 21, 2002 4:17 am    Post subject: Reply with quote

the thing you're looking for is the PS1 variable in your .bashrc ... the bash manual is located right here: http://www.gnu.org/manual/bash-2.05a/bashref.html
_________________
Kyle
Back to top
View user's profile Send private message
credmp
Apprentice
Apprentice


Joined: 02 Jul 2002
Posts: 207
Location: Netherlands

PostPosted: Wed Aug 21, 2002 8:13 am    Post subject: Reply with quote

Hi,

I actually use the following code in my .bashrc I found this on the internet somewhere (forgot exactly where.. think deskmod) and it is written by someone else.. but iy works very nicely :)

Code:

function set_hist_color {
        # $? - exit value of last command
        if [ $? -gt 0 ]
        then
                HIST_COLOR='1;31' # success
        else
                HIST_COLOR='1;30' # failure
        fi
}

function display_clock {
        LIGHT_BLUE="$(tput setaf 5; tput bold)"
        DEFAULT="$(tput sgr0)"

        CLOCK="[$LIGHT_BLUE$(date +%H:%M:%S)$DEFAULT]"

        # <columns in display> - len($CLOCK)
        let UPPER_RIGHT=$(tput cols)-10

        tput sc
        # change 1 to 0 if it is too low on the screen
        tput cup 1 ${UPPER_RIGHT}
        echo -n ${CLOCK}
        tput rc
}

function prompt_command {
        set_hist_color
#       display_clock
}

function ps1 {
        # Colour Macros
        BLUE='\[\033[0;34m\]'
        LIGHT_CYAN='\[\033[1;36m\]'
        WHITE='\[\033[1;37m\]'
        GREEN='\[\033[01;32m\]'
        DEFAULT='\[\033[0m\]'

        # Pre-Prompt Function
        PROMPT_COMMAND=prompt_command

        # Prompt
        # \! - history number of last command
        # $? - exit value of last command
        # \t - exit time of last command
        # \w - current directory (relative)
        PS1="$BLUE[$GREEN\u@$LIGHT_CYAN\h \[\033[\$(echo -n \$HIST_COLOR)m\]\!$B            LUE] $WHITE\W$LIGHT_CYAN\$ $DEFAULT"
}

ps1


I had to make a fix in the display_clock code for aterm, see the comments.

anyways.. it makes a promtp like:

Code:

[arjenw@jay 511] private$


enjoy.

Arjen
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Aug 21, 2002 8:28 am    Post subject: Reply with quote

OK, we already have a bash prompt thread that I posted a link to earlier. If anybody has a great prompt they'd like to share, that's the place. Locking.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Sun Oct 13, 2002 6:50 pm    Post subject: Reply with quote

rac wrote:
  • Check out this thread, which came up doing a forum search for "bash and prompt" in the Documentation, Tips & Tricks forum.


If anyone missed it earlier, this link is the preferred thread.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads 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