bash prompts

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Screenshots

Unread post by dkeg » Mon Sep 02, 2013 1:30 pm

just something I picked up on the interwebs, and cleaned up a bit. the one in the scrot above I just moved the newline character to before the working directory.
edit: just use this, pretty much the original. I found issues with my modified version

Code: Select all

PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;33m\]\u\[\033[0;37m\]]\342\224\200[\[\033[0;31m\]\h'; else echo '\[\033[0;36m\]\u\[\033[0;37m\]]\342\224\200[\[\033[0;31m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]" 

Work hard; Complain less

digz
Oyster-Slurper
Posts: 27
Joined: Sat Aug 31, 2013 5:04 pm

Re: Screenshots

Unread post by digz » Mon Sep 02, 2013 6:53 pm

dkeg wrote:just something I picked up on the interwebs, and cleaned up a bit. the one in the scrot above I just moved the newline character to before the working directory.
edit: just use this, pretty much the original. I found issues with my modified version

Code: Select all

PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;33m\]\u\[\033[0;37m\]]\342\224\200[\[\033[0;31m\]\h'; else echo '\[\033[0;36m\]\u\[\033[0;37m\]]\342\224\200[\[\033[0;31m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]" 
beautiful, thanks. do you know how i can set it to start with each new terminal window?

edit- nevermind, worked it out.
Last edited by digz on Tue Sep 03, 2013 2:25 am, edited 2 times in total.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Screenshots

Unread post by DebianJoe » Mon Sep 02, 2013 6:59 pm

Set it in your ~/.bashrc digz, assuming that bash is your default shell.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

digz
Oyster-Slurper
Posts: 27
Joined: Sat Aug 31, 2013 5:04 pm

Re: Screenshots

Unread post by digz » Mon Sep 02, 2013 7:01 pm

you beat me to editing my post (;

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Screenshots

Unread post by dkeg » Mon Sep 02, 2013 7:10 pm

Great!

Open up and place in your .bashrc

Edit, woop, too late

edit2: cleaned up simpler version

Code: Select all

PS1="\[\033[0;37m\]\[[\033[0;36m\]\u\[\033[0;37m\]]\342\224\200[\[\033[0;31m\]\h\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274\[\033[0m\]"
If interested, this is the breakdown

Code: Select all

[username] - \[\033[0;37m\]\[[\033[0;36m\]\u\[\033[0;37m\]]

dash - \342\224\200

[hostname] - [\[\033[0;31m\]\h\[\033[0;37m\]]

dash - \342\224\200

[working directory] - [\[\033[0;32m\]\w\[\033[0;37m\]]

newline - \n

line - \[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274

entered command - \[\033[0m\]
result
Image

Work hard; Complain less

digz
Oyster-Slurper
Posts: 27
Joined: Sat Aug 31, 2013 5:04 pm

Re: Screenshots

Unread post by digz » Mon Sep 02, 2013 9:01 pm

hrm, that version gives me:
└â\ 200─╼
could you share your wall?

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Screenshots

Unread post by dkeg » Mon Sep 02, 2013 9:15 pm

try again, there were some unwanted spaces in there.

wall
http://s19.postimg.org/vi1ozy96r/fogforest.jpg

Work hard; Complain less

digz
Oyster-Slurper
Posts: 27
Joined: Sat Aug 31, 2013 5:04 pm

Re: Screenshots

Unread post by digz » Mon Sep 02, 2013 9:45 pm

cheers, working now.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: bash prompts

Unread post by machinebacon » Thu Oct 24, 2013 7:02 am

I like that. Can you show the PS1= ?
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: bash prompts

Unread post by rhowaldt » Thu Oct 24, 2013 7:16 am

i always liked those prompts that had the info, then the ASCII-lines and shit to the line underneath. beautiful. i use a much simpler prompt myself but if i ever switch it will be to something like that.
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: bash prompts

Unread post by dkeg » Thu Oct 24, 2013 1:53 pm

machinebacon wrote:I like that. Can you show the PS1= ?
pretty much the same as the PS1 posted above, with some slight mods to add battery status to the prompt

Code: Select all

PS1="\[\033[0;37m\]\][\[\033[0;35m\]\$(/path/to/battstat.sh)\033[0;37m\]]\342\224\200[\[\033[0;31m\]\[\A\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\224\200\342\224\200\342\225\274 \[\033[0m\]"
Attachments
scrot.png
scrot.png (702 Bytes) Viewed 11983 times

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: bash prompts

Unread post by machinebacon » Thu Oct 24, 2013 6:03 pm

Thanks Drew, I just noticed that we're in the bash_prompts thread :D Sorry for the trouble :)
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: bash prompts

Unread post by dkeg » Thu Oct 24, 2013 6:15 pm

never trouble.

Work hard; Complain less

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: bash prompts

Unread post by wuxmedia » Fri Oct 25, 2013 12:51 pm

^ did you mean green, with envy? or actually become yellow hued? have to stick the ansi weather script in there for S11 8P
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: bash prompts

Unread post by dkeg » Sat Oct 26, 2013 1:52 pm

I split off the battstat in prompt to the HOWTO section.

http://www.linuxbbq.org/bbs/viewtopic.php?f=19&t=807

Work hard; Complain less

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: bash prompts

Unread post by GekkoP » Fri Nov 29, 2013 8:55 am

This looks bloat, but it may be fun.
https://github.com/nojhan/liquidprompt

User avatar
Titan
なまいき
Posts: 407
Joined: Sat Oct 20, 2012 7:12 pm
Location: UK
Contact:

Re: bash prompts

Unread post by Titan » Thu Dec 12, 2013 12:23 pm

Thanks Drew, ive added this to my bashrc.
* Be fat, be as fat as you fucking please, just don't sit next to me on an aeroplane.
* "The sun never sets on the British Empire...." "Yeah, well, the sun never sets on my asshole!!"
* I am an "old skool" administrator who has been managing UNIX and Linux systems since the early 80s <-- big fkin lol

User avatar
mrneilypops
Bad Advice Dog
Posts: 143
Joined: Wed Oct 17, 2012 9:15 pm
Location: Luxembourg
Contact:

Re: bash prompts

Unread post by mrneilypops » Thu Jan 09, 2014 8:42 pm

Very nice work!

User avatar
rust collector
Motörhead
Posts: 535
Joined: Mon Jan 13, 2014 3:56 pm
Location: no_nb

Re: bash prompts

Unread post by rust collector » Fri Mar 07, 2014 2:29 am

This is not anything fancy, but it is my favorite ps1 line:

Code: Select all

PS1="\[\e]2;\u@\H \w\a\e[32;1m\]>\[\e[0m\] "
This will only work properly if your terminal or window manager has an
"information area" like a toolbar, or so.
If it does not, you won't know where you are!
Last edited by rust collector on Fri Mar 07, 2014 3:39 pm, edited 1 time in total.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: bash prompts

Unread post by machinebacon » Fri Mar 07, 2014 4:25 am

Thanks rusty! Is it meant to show only a ">"? For me it does (I'm using bash indeed). Though from what I see in the line, it should at least show the user name and the host...

Can you make a quick scrot of yours?
..gnutella..

Post Reply