View previous topic :: View next topic |
Author |
Message |
slimbim n00b
Joined: 14 Aug 2002 Posts: 29
|
Posted: Wed Aug 21, 2002 3:48 am Post subject: command prompt always just say bash-2.05a$ |
|
|
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 |
|
|
gfunkmonk Tux's lil' helper
Joined: 10 Jul 2002 Posts: 129 Location: Freelandville, IN
|
Posted: Wed Aug 21, 2002 3:51 am Post subject: |
|
|
try running it with the -ls option
like
xterm -ls |
|
Back to top |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Wed Aug 21, 2002 3:59 am Post subject: |
|
|
- 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 |
|
|
slimbim n00b
Joined: 14 Aug 2002 Posts: 29
|
Posted: Wed Aug 21, 2002 4:02 am Post subject: |
|
|
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 |
|
|
slimbim n00b
Joined: 14 Aug 2002 Posts: 29
|
Posted: Wed Aug 21, 2002 4:04 am Post subject: |
|
|
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 |
|
|
Logik n00b
Joined: 15 Aug 2002 Posts: 9 Location: Michigan
|
|
Back to top |
|
|
credmp Apprentice
Joined: 02 Jul 2002 Posts: 207 Location: Netherlands
|
Posted: Wed Aug 21, 2002 8:13 am Post subject: |
|
|
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 |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Wed Aug 21, 2002 8:28 am Post subject: |
|
|
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 |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Sun Oct 13, 2002 6:50 pm Post subject: |
|
|
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 |
|
|
|