Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Extra informative Bash prompt
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Binestar
n00b
n00b


Joined: 14 Nov 2002
Posts: 58

PostPosted: Fri Nov 22, 2002 3:28 pm    Post subject: Reply with quote

I'm actually someone tho likes to use tcsh for a prompt instead of bash:

I use a very simplistic:
Code:

set prompt="%t (%n@%m) %/ (%h) "

line in my .tcshrc

That gives me:
Code:

10:24am (username@computer) /current/directory/ (64)


The (64) is the number of commands you have entered in that session. It starts at (1) (obviously) and goes up.

I use 'screen' and this prompt allows me to always know what user I'm logged in as, as well as which machine, and which directory. This is information I find priceless as I work through the day on dozens of tasks, all in the same Terminal window (Different screens)

emerge screen and have a look at what it can do if you've never used it.


Binestar
Back to top
View user's profile Send private message
ryan83vt
Guru
Guru


Joined: 28 Oct 2002
Posts: 370
Location: Blacksburg, VA

PostPosted: Tue Feb 11, 2003 8:59 pm    Post subject: Reply with quote

I am trying to write a script to set PS1 but it's not changing anything.

Code:

#!/bin/bash
clear
export PS1=`uname -sr;date +%D`


can anybody tell me why? if I echo PS1 from within the script it outputs correctly but it doesn't actually change anything.
Back to top
View user's profile Send private message
ryan83vt
Guru
Guru


Joined: 28 Oct 2002
Posts: 370
Location: Blacksburg, VA

PostPosted: Tue Feb 11, 2003 9:17 pm    Post subject: Reply with quote

ryan83vt wrote:
I am trying to write a script to set PS1 but it's not changing anything.

Code:

#!/bin/bash
clear
export PS1=`uname -sr;date +%D`


can anybody tell me why? if I echo PS1 from within the script it outputs correctly but it doesn't actually change anything.


I figured out if I run the file ./filename it wont work but if I run . ./filename then it works.
Back to top
View user's profile Send private message
dylix
Apprentice
Apprentice


Joined: 20 Sep 2002
Posts: 261
Location: Atlanta

PostPosted: Fri Feb 14, 2003 4:33 am    Post subject: Reply with quote

mines simple really.. thats the way i like it tho..

Code:
PS1='\[\033[01;31m\]\h \[\033[01;34m\](\w) \$ \[\033[00m\]'


dylix@reaction (~) $
Back to top
View user's profile Send private message
chadders
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jan 2003
Posts: 113

PostPosted: Fri Feb 14, 2003 5:30 am    Post subject: Reply with quote

Heres mine:

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

it gives:
[root@myputr etc]#

Chad
Back to top
View user's profile Send private message
TenPin
Guru
Guru


Joined: 26 Aug 2002
Posts: 500
Location: Kansas City

PostPosted: Sun Feb 16, 2003 1:20 am    Post subject: Reply with quote

Code:
PS1="\[\033[01;32m\]\u@\h \[\033[1;36m\]\$(/bin/ls -A1 | /usr/bin/wc -l | /bin/sed 's: ::g') \[\033[1;31m\]\$(/bin/ls -lAh | /bin/grep -m 1 total | /bin/sed 's/total //')\[\033[01;34m\] \W \[\033[0m\]"


Gives

tenpin@helix 7 312K ~
Back to top
View user's profile Send private message
R@NNIS
n00b
n00b


Joined: 30 Oct 2002
Posts: 42
Location: somewhere

PostPosted: Sun Feb 16, 2003 3:41 pm    Post subject: my prompt for anyone :) Reply with quote

http://lycos42.free.fr/gentoo/conf/lycos_prompt.bash

so for the features...

i think my changelog could be rather explicit :)

# Lycos_prompt.
# This is my personal prompt based on Giles howto bash prompt.
# it uses term wide font , bg status , time , and in near future
# will have some pwd color permissions.
# mail : rannis@free.fr
#
# to use it just put this line in your $HOME/.bashrc
# ---------cut here--------
# [ -f /path/to/lycos_prompt.bash ] && source /path/to/lycos_prompt.bash
# For Gentoo Users add this to have bash completion for emerge.
# emerge bash-completion to take advantage of this.
# [ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
# ---------cut here--------
#
#
## Last update Thu Dec 16 02:46:37 2003 Lycos
#
# v1.08b: -BUGFIX forgot non gentoo users ;) ${#temp} for len calculation.
# -Added DiskSpace Monitor(current path) When not Emerging :
# => green < 65%
# => white > 65% && < 85%
# => red > 85%
#
# v1.08: -Added Relative $HOME dir PATH.
#
# v1.07c: -BUGFIX term wide calculation bug ==> corrected for C_EMERGE & != hostname/usernames.
# -TODO: Verify ${#temp}%2
#
# v1.07b: -BUGFIX special char bug in $PWD(thx Nemerid)
#
# v1.07 : -BUGFIX last exit code ==> just annoying newbie bug sorry :)
# -Added a bit documentation...
# -Hmmm ... time to do .... lots of changes ... becoming really dirty :D
# -TODO: Modularize lots of thing ...
# -TODO: re-write everything a bit nicer.
# -TODO: propose sample configuration(modules ?).
#
# v1.06 : -Added current emerging package (gentoo users only ...
# NEEDED FEATURE : sandbox)
# -Added superuser detection (red color).
# -Added DIST_GENTOO var for gentoo/non-gentoo users.
# -Added lots of termwide bugs :) I know ;) will correct them in next release :)
#
# v1.05 : -Added Directory coloration
# if owner => grey
# write denied => red
# write permission => bluegreen
# -BUGFIX with date length corrected.
# -Removed bash-completion for gentoo users(see first header)
#
# V1.04 : -BUGFIX when opening new terminal(thx Nemerid : "bad size for $COLUMNS").
#
# v1.03 : -Added last return code prompt with value + color.
# -Added a Batterie Status monitor for APM.
#
# v1.02 : -Added jobs viewer (you can see your current nb of bg jobs).
#
# v1.01 : -Added emerge bash Completion for gentoo .
# -For Gentoo users (emerge bash-completion)
# -BUGFIX with bash-completion(thx war[sheep] , pbably pb with dot files completion or fct exec properties ???).
#
# v1.0 : -Initial release
# -Term Wide Prompt
# -Some Colors
#

here some screenshots

a overview :)
[img:b1a8d7793e]http://lycos42.free.fr/gentoo/conf/lycos_prompt.jpg[/img:b1a8d7793e]

a friend made a screenshot to show apm on the bottom left beside the path.
[img:b1a8d7793e]http://marc.stock1.free.fr/junks/lycos.jpg[/img:b1a8d7793e]

for any comments or question mail me to rannis@free.fr

when i' ll have time :) i continue the upcoming version 2.0 of this prompt but much nicer => modular with config file.
Back to top
View user's profile Send private message
jhs_bangkok
n00b
n00b


Joined: 12 Feb 2003
Posts: 3

PostPosted: Sun Feb 16, 2003 6:08 pm    Post subject: Re: ps1 Reply with quote

xming wrote:
this is mine:

<snip code>

I have been using it for 10 years

xming


xming, that's very similar to my prompt, and hence the best I've seen so far!

I think I might actually add the time to my prompts. Thanks for the suggestion.

Anyway, I thought I'd share some of my .bashrc -- actually /etc/bashrc.d/50.prompt (I make it behave like rc.d because it's become so unwieldly). The prompt is exactly like the Slackware prompt (at least from version 3.3 when I first used it), except with color. I used it a lot as a university lab sysadmin, and students started to like it, so I made it pretty obvious to customize.

Code:

#!/bin/sh

# Set a prompt for shells

    normal='\[\033[0m\]'
     white='\[\033[1;29m\]'
      gray='\[\033[1;30m\]'
       red='\[\033[1;31m\]'
     green='\[\033[1;32m\]'
    yellow='\[\033[1;33m\]'
      blue='\[\033[1;34m\]'
   magenta='\[\033[1;35m\]'
      cyan='\[\033[1;36m\]'

# edit this to alter colors
      user="${magenta}\u"
        at="${normal}@"
      host="${green}\h"
     colon="${normal}:"
       dir="${cyan}\w"
    prompt="${normal}\\$ "

# edit this to alter form

if [ "$SHELL" = '/bin/bash' ] || [ "$SHELL" = '/bin/sh' ]; then
        if [ `/usr/bin/whoami` = 'root' ]; then
                # I am root
                warning=" ${red}Root "
        else
                # I am not root
                unset ROOTPATH
                warning=""
        fi

        # This one prints an extra warning, which can get annoying on e.g. test machines
        PS1="${user}${at}${host}${colon}${dir}${warning}${prompt}"

        # This one bypasses the warning
        # PS1="${user}${at}${host}${colon}${dir}${prompt}"
fi

export PS1

[/code]
Back to top
View user's profile Send private message
MattElmore
n00b
n00b


Joined: 01 Feb 2003
Posts: 29

PostPosted: Thu Feb 20, 2003 9:13 pm    Post subject: Reply with quote

If anyone is still having trouble getting their settings to be universal using bash here is the trick I use.

I put all my settings in the file ~/.bash_profile
I then make a symblic link to that file called ~/.bashrc

This will make all terminals show up uniformly, even when you su!

btw here's mine: PS1='\[[\033[0;32m\]\u\[\033[0;37m\]@\[\033[0;32m\]\h\[\033[0;37m\]:\[\033[0;31m\]\w\[\033[0m\]]$ '

you can look at it here: www.mattelmore.com/images/screenshot.jpg
Back to top
View user's profile Send private message
Kodama
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jan 2003
Posts: 85
Location: Linköping, Sweden

PostPosted: Fri Apr 11, 2003 10:58 am    Post subject: Reply with quote

I have experemented with an color gradient bashprompt.

In .bashrc:

Code:
PS1="\[\033[1;31m\$(/stuff/gradient)\[\033[0m\]"


My ugly "color gradient" script:

Code:
STRING="$PWD -> "

ONE=${STRING:0:1}
TWO=${STRING:1:1}
THREE=${STRING:2:1}
FOUR=${STRING:3:1}
FIVE=${STRING:4:1}
SIX=${STRING:5:1}
SEVEN=${STRING:6:1}
EIGHT=${STRING:7:1}
NINE=${STRING:8:1}
TEN=${STRING:9:1}
ELEVEN=${STRING:10:1}
TWELVE=${STRING:11:1}
THIRTEEN=${STRING:12:1}
FOURTEEN=${STRING:13:1}
FIFTEEN=${STRING:14:1}
SIXTEEN=${STRING:15:1}
REST=${STRING:16}

echo -e "\033[1;30m$ONE\033[1;30m$TWO\033[1;34m$THREE\033[1;34m$FOUR\033[1;35m$FIVE
\033[1;35m$SIX\033[1;36m$SEVEN\033[1;36m$EIGHT\033[1;37m$NINE\033[1;37m$TEN
\033[1;36m$ELEVEN\033[1;36m$TWELVE\033[1;35m$THIRTEEN\033[1;35m$FOURTEEN
\033[1;34m$FIFTEEN\033[1;34m$SIXTEEN\033[1;30m$REST"


My .Xresources:

Code:
XTerm*cursorColor: #adb9c9
# 30
#XTerm*color0:   #6BA1FF
# 31
#XTerm*color1:   #B2BCFF
# 32
#XTerm*color2:   #98BEFF
# 33
#XTerm*color3:   #ffff00
# 34
XTerm*color4:  #8AAFD3
# 35
#XTerm*color5:   #eed8ae
# 36
#XTerm*color6:   #b4eeb4
# 37
XTerm*color7: #F2FFFB
# 1;30
XTerm*color8:   #5b97cc
# 1;31
#XTerm*color9:   
# 1;32
#XTerm*color10:  #DDF0FF
# 1;33
#XTerm*color11:  #98D2FF
# 1;34
XTerm*color12: #70A1CC
# 1;35
XTerm*color13:  #88B3D8
# 1;36
XTerm*color14: #97BBDA
# 1;37 white
XTerm*color15:  #aac8e2


A screenshot of the results:

[img:ebef22f2f2]http://m50.ryd.student.liu.se/aterm.jpg[/img:ebef22f2f2]
Back to top
View user's profile Send private message
negativecreep
n00b
n00b


Joined: 07 Feb 2003
Posts: 18

PostPosted: Fri Apr 11, 2003 12:03 pm    Post subject: Reply with quote

This is what I use. The trimpwd functions concentrates your $PWD if it gets to long.

Code:

function trimpwd
{
   [ -z ${npwd="`expr \"${PWD/$HOME/~}\" : '[~/].*/\(\(.*/\)\{'${1:-1}'\}.*\)'`"} ] && echo ${PWD/$HOME/~} || echo ..$npwd
}

function setprompt
{
   [ `/usr/bin/whoami` = 'root' ] && ucolor="\[\e[1;32m\]" || ucolor="\[\e[0;32m\]"
   PS1="$ucolor\u\[\e[0;32m\]/\h\[\e[0;36m\] `trimpwd` \[\e[0;33m\]{\j}\[\e[0;31m\]% \[\e[0m\]"
   export PS1
}

PROMPT_COMMAND=setprompt



Looks something like this:

Code:

alex/negativ ..prosjekter/trimpwd {0}%
Back to top
View user's profile Send private message
m3thos
n00b
n00b


Joined: 09 Apr 2002
Posts: 46
Location: Portugal

PostPosted: Fri Apr 11, 2003 6:48 pm    Post subject: Here are my prompts... Reply with quote

[73p] quark : ~ $ echo $PS1
\[\033[1;34m\][$(ps axm | wc -l | sed -e "s: ::g")p] \[\033[1;32m\]\h\[\033[0m\] : \[\033[1;31m\]\w \[\033[0m\]$

It shows: number of processes running, machine name, and path.. this is my root prompt(for root).

here is my normal user prompt:
--(quark)-(pts0)-(19:44/11-Abr-03)--
--<~>-- echo $PS1
\[\033[1;30m\]-\[\033[1;36m\]-\[\033[0;36m\](\[\033[1;33m\]\h\[\033[0;36m\])\[\033[1;36m\]-\[\033[0;36m\](\[\033[1;30m\]\[\033[1;32m\]pts0\[\033[0;36m\])\[\033[1;36m\]-\[\033[0;36m\](\[\033[1;31m\]$(date +%H:%M)\[\033[1;30m\]/\[\033[1;31m\]$(date +%d-%b-%y)\[\033[0;36m\])\[\033[1;36m\]-\[\033[1;30m\]-\[\033[0;37m\]\n\[\033[1;30m\]-\[\033[1;36m\]-\[\033[0;36m\]<\[\033[1;34m\]\w\[\033[0;36m\]>\[\033[1;36m\]-\[\033[1;30m\]-\[\033[0;37m\] \[\033[0m\]
_________________
Miguel Sousa Filipe
handle: m3thos
More human than human
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Sun Apr 13, 2003 11:33 pm    Post subject: Reply with quote

oooh kodama, could you please share that prompt background?

here's some nifty bash stuff.
Back to top
View user's profile Send private message
Kodama
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jan 2003
Posts: 85
Location: Linköping, Sweden

PostPosted: Mon Apr 14, 2003 6:35 am    Post subject: Reply with quote

The Aterm background is transparent. You can get the wallpaper here.
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Mon Apr 14, 2003 12:10 pm    Post subject: Reply with quote

oh, i see. thanks for the wall!
Back to top
View user's profile Send private message
motiv8x
n00b
n00b


Joined: 19 Feb 2003
Posts: 21

PostPosted: Mon May 05, 2003 6:51 pm    Post subject: Reply with quote

i did an "emerge -uD world" recently, and now my root bash prompt isn't red anymore. It's the regular green and blue.

I checked /etc/profile, and I still have this line:
export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'

(contained within if [ "$LOGNAME" = 'root' ])

I'm not sure if $LOGNAME is getting set, or if /etc/profile is even being read. I do have it sourced from both root and users' .basrc and .bash_profile

I even put the export line above in root's .bashrc and still no red prompt.

any clues?
_________________
join #gentoo-help on irc.freenode.net
Politics for Engineers
Back to top
View user's profile Send private message
Sedated
n00b
n00b


Joined: 25 Feb 2003
Posts: 32
Location: Edmonton, Alberta, Canada

PostPosted: Mon May 12, 2003 2:57 am    Post subject: /etc/profile in general Reply with quote

Code:
# Below are the color init strings for the basic file types. A color
# init string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white

CLR='\[\033[0m\]'
BLACK='\[\033[0;30m\]'
MAROON='\[\033[0;31m\]'
GREEN='\[\033[0;32m\]'
OLIVE='\[\033[0;33m\]'
NAVY='\[\033[0;34m\]'
PURPLE='\[\033[0;35m\]'
TEAL='\[\033[0;36m\]'
BEIGE='\[\033[0;37m\]'
DARKGREY='\[\033[1;30m\]'
RED='\[\033[1;31m\]'
LIME='\[\033[1;32m\]'
YELLOW='\[\033[1;33m\]'
BLUE='\[\033[1;34m\]'
MAGENTA='\[\033[1;35m\]'
CYAN='\[\033[1;36m\]'
WHITE='\[\033[1;37m\]'

TTY=$(basename `tty`)

if [ "$BASH" ]; then
  # PS1='\u@\h:\w\$ '
  if [ "`id -u`" = "0" ]; then
    COLOR="${MAROON}"
    PS1="${CLR}\u${COLOR}@${CLR}\h${COLOR}:${CLR}${TTY}${COLOR}:${CLR}\w${COLOR}\$ ${CLR}"
  else
    COLOR="${PURPLE}"
    PS1="${CLR}\u${COLOR}@${CLR}\h${COLOR}:${CLR}${TTY}${COLOR}:${CLR}\w${COLOR}\$ ${CLR}"
  fi
else
  if [ "`id -u`" -eq 0 ]; then
    PS1='# '
  else
    PS1='$ '
  fi
fi

echo
export FULLNAME=`grep "^$USER" /etc/passwd|cut -f 5 -d:|cut -f1 -d,`
echo "  Welcome" $FULLNAME
echo "  "`date "+%A, %B %-d, %-I:%M%P, %Y %Z %z"`
echo " "`up`      # http://www.burdell.org/code/up/up-1.0.tar.gz

which gives me:
[img:bafe918072]http://nymphony.net/screenshots/bash.png[/img:bafe918072]
Pretty simplistic, but somewhat imformative and it doesn't blind the eyes either.
_________________
Sedated
Quote:
sedated@therapy:tty3:~$ fortune
"If you lend someone twenty dollars, and never see that person again, it was probably worth it."
Back to top
View user's profile Send private message
Bangz
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2003
Posts: 148
Location: Brisbane/Austrralia

PostPosted: Sun Jun 01, 2003 4:36 am    Post subject: Reply with quote

This is mine.

Code:
export PS1='\n\[\033[32m\]\w\n\[\033[0m\]\[\033[1;35m\]\u \033[1;33m\]-> \[\033[0m\]'


Simple but sexy :)
Back to top
View user's profile Send private message
Bangz
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2003
Posts: 148
Location: Brisbane/Austrralia

PostPosted: Sun Jun 01, 2003 4:37 am    Post subject: Reply with quote

motiv8x wrote:
i did an "emerge -uD world" recently, and now my root bash prompt isn't red anymore. It's the regular green and blue.

I checked /etc/profile, and I still have this line:
export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'

(contained within if [ "$LOGNAME" = 'root' ])

I'm not sure if $LOGNAME is getting set, or if /etc/profile is even being read. I do have it sourced from both root and users' .basrc and .bash_profile

I even put the export line above in root's .bashrc and still no red prompt.

any clues?


try changing $LOGNAME to `whoami`
Back to top
View user's profile Send private message
ribo
n00b
n00b


Joined: 14 Aug 2002
Posts: 53

PostPosted: Sun Jun 01, 2003 7:12 am    Post subject: Reply with quote

this is what i am using:

Code:
 export PS1='[ \[\033[01;31m\]\t\[\033[01;34m\] :: \[\033[01;32m\]\u\[\033[00m\]\$\[\033[01;32m\]\h\[\033[01;34m\] :: \[\033[01;32m\]\w \[\033[00m\]] '


looks like:
Code:
[ 01:11:12 :: ribo$zeruel :: /proc/ide ]


with various colors. I have a eterm command i use to get some nice colors in it: http://system42.net/ribo/eterm

I also have a matching irssi theme.
Back to top
View user's profile Send private message
SpinDizzy
n00b
n00b


Joined: 28 May 2003
Posts: 63
Location: Moss Vale, Australia

PostPosted: Tue Jun 03, 2003 1:39 pm    Post subject: Reply with quote

Ahh, prompts, always a good place to flex your terminal code might.

Assuming you are using a VT100 compatible terminal (eg the linux terminal) you have access to the following codes:

ESC7 to save the current cursor position
ESC8 to restore the current cursor position
ESC[ROW;COLUMNH to set the cursor position to position ROW, COLUMN on the screen.

Thus, in bash the snippet
Code:
\[\e7\e[0;71H\@\e8\]


Will place the time in the top right corner of the console.

Obviously the possibilities for this are endless and allows you to put lots of up to date information on the screen without having a prompt that scrolls your terminal three lines at time. It all can be put in a stationary position on the screen.

Notes:

1) The \[ and \] are to tell bash that the enclosed is "non-printable" and prevents it from thinking your prompt line is twice as long as it really is.
2) The cursor position starts at 0,0 (top left), bottom right on a 80x25 screen would be 24,79.
3) I check the $TERM variable and don't bother showing a clock on an xterm.
Back to top
View user's profile Send private message
Frozenwings
n00b
n00b


Joined: 02 Apr 2003
Posts: 47

PostPosted: Wed Jun 04, 2003 1:55 am    Post subject: Reply with quote

SpinDizzy wrote:

Obviously the possibilities for this are endless and allows you to put lots of up to date information on the screen without having a prompt that scrolls your terminal three lines at time. It all can be put in a stationary position on the screen.


Hey, this is cool. And now that I'm experimenting weird stuff with bash,
it should be really cool to show off :P Thanks!
This is my prompt:
Code:

#================= User prompt =================
function prompt_command {
local PWD="$(pwd | sed s:${HOME}:~:)"
local JOBS="$(jobs | head -c1)"
if [ $PWD = '/' ]; then PWD="$CYA$HOST"; fi
if [ $JOBS ]; then BG="$GRN"; else BG="$BLU"; fi

PS1="$BG<$WHI$PWD$BG>$CLR"

if [ `whoami` = "root" ]; then
if [ $JOBS ]; then BG="$YEL"; else BG="$RED"; fi
PS1="$BG<$WHI$PWD$BG>$CLR"; fi
}

PROMPT_COMMAND=prompt_command

Looks like
<~/S>
And, if there are background processes:
<~/S>
(Change blue and green for red and yellow for root)
I also have nice funtions for recursive retrieval and file extraction, if anyone
is interested, I'll post my bashrc :P
Back to top
View user's profile Send private message
FormerSlacker
Guru
Guru


Joined: 11 Mar 2003
Posts: 340
Location: Toronto, ON. Canada

PostPosted: Wed Jun 04, 2003 11:33 am    Post subject: Reply with quote

Here is a old prompt I've been using for ages. Here is the code for myprompt.sh
Code:

 function defprompt {
PS1="\[\033[34m\](\[\033[36m\]\\#\[\033[34m\])\[\033[36m\]\\u\[\033[34m\]@\
\[\033[36m\]\\h\[\033[34m\](\[\033[36m\]$(bptty)\[\033[34m\]-\
\[\033[36m\]\$(bptime)\[\033[34m\]\[\033[36m\]\[\033[34m\])\n\
\[\[\033[34m\][\[\[\033[36m\]\\w\[\033[34m\]>\[\033[00m\] "
PS2="> "
}
function bptime ()
{
  echo -n $(date +%l:%M%P)
}
function bptty ()
{
  echo -n $(tty | cut -c6-14)
}


To use it, simply add these lines to your bashrc or profile, or just on the prompt.
Code:

source myprompt.sh
defprompt


If all goes well, you should have something like this:
[img:9d415d1a41]http://members.rogers.com/mlopes275/prompt.png[/img:9d415d1a41]
Back to top
View user's profile Send private message
Bangz
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2003
Posts: 148
Location: Brisbane/Austrralia

PostPosted: Thu Jun 05, 2003 11:29 am    Post subject: Reply with quote

Can anyone help me on this one.

I'm using what I pasted above:

Code:
PS1='\n\[\033[32m\]\w\n\[\033[0m\]\[\033[1;35m\]\u \033[1;33m\]-> \[\033[0m\]'


Now, it works. Except I have two problems.

One. When I log in when my system boots, and I am in the CLI with my Gentoo Bootplash screen (1280x1024) - I have an extra character in the display.

It's like:

~
root *->

everywhere else it's:

~
root ->

Note, it doesnt actually display '*', the actual character is square, and looks kinda like it has a smilie face in it.


Secondly. When my typing goes into another line, my entire input goes WEIRD. For example, if I type "aaaaaaaaaabbbbbbbbbbbbbbccccccccccccccccdddddddddddddeeeeeeeeeeeeeeee"

which will go into a new line on the terminal, it looks like this in XTerm:

http://threeten.com/images/wtf.png

I have no Bash Scripting Knowledge, my PS1 was backed of hacking a few examples together.

Anyone have any insight for these two problems?
Back to top
View user's profile Send private message
FormerSlacker
Guru
Guru


Joined: 11 Mar 2003
Posts: 340
Location: Toronto, ON. Canada

PostPosted: Thu Jun 05, 2003 12:04 pm    Post subject: Reply with quote

The problem is that you've made a minor typo. In your example:

\033[1;33m\] should be \[\033[1;33m\]

Here is your prompt fixed.
Code:

PS1="\[\033[32m\]\w\[\033[0m\]\n\[\033[1;35m\]\u\[\033[1;33m\]-> \[\033[0m\]"


Bangz wrote:
Can anyone help me on this one.

I'm using what I pasted above:

Code:
PS1='\n\[\033[32m\]\w\n\[\033[0m\]\[\033[1;35m\]\u \033[1;33m\]-> \[\033[0m\]'

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 3 of 9

 
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