Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Change $PS1< Next Oldest | Next Newest >
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: July 22 2008,18:28 QUOTE

First of all, you may ask what is $PS1 - it is the primary prompt that you see in a terminal, such as:
dsl@box:/tmp/somedir$

Then you may ask why would I want to change that (what is pretty much standard everywhere).  When you want to copy something from the prompt in an X terminal emulator, it would, for example, select more than just the path when you double click on it.  Double clicking is easier and faster than highlighting the whole thing or running `pwd`, etc.

Currently 4.x(?) has dsl@box:/mydir$ for user dsl.
Root's is a blue [/mydir]# which does allow you to double click.

dslcore has dsl@box:/mydir$ for user dsl and root has root@box:/mydir#
Perhaps the root prompt should be in color like in previous versions?
I know this isn't the dslcore section, but this post applies to the current series as well.

I set PS1 in .bashrc to override the default for my interactive shells (or .profile for ash I suppose).  I use something like "dsl@box /mydir>$" at the moment.  Are there any actual set standard on how this should be?

I wonder if others will have a use for this.
Back to top
Profile PM 
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: July 22 2008,19:08 QUOTE

It's the first thing people used to customize in their Linux systems :)
Mine looks like

ti 22. heinäkuuta 2008 22:06:58, celebear kansiossa ~ :P

With date on yellow and everything after the comma in green.


--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: July 22 2008,21:24 QUOTE

I also use .bashrc for this, inside the "if $PS1" block.  I used to cat an external file, which made it easy to program a change when changing my desktop theme, but that was dropped when I dropped the whole idea of desktop themes.

PS1="\[\033[0;37m\]( o_\n/ >) [\w]\[\033[0m\]\n"
looks like
Code Sample
( o_
/ >) [~]


I've got root's PS1 set in root's .bashrc:
[ -n "$TTY" ] && PS1="\[^[[1;34m\]\w@$TTY[\W]#\[^[[0;39m\] " || PS1="\[^[[1;34m\][\w]#\[^[[0;39m\] "
Honestly can't remember if this behaves the way I had originally planned, considering I don't remember doing this =o)


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
chaostic Offline





Group: Members
Posts: 328
Joined: Mar. 2005
Posted: July 22 2008,21:35 QUOTE

on OSx:
PS1='\u@\h:\w '
chaostic@OSX:~
chaostic@OSX:~ cd Desktop/
chaostic@OSX:~/Desktop

On DSLcore, the standard prompt for now.

on DSL 3/4, I mostly use ssh, so the standard prompts for user or root are used unless I ssh'd in. Then it gets colored, and shows the hostname of the incoming ssh connection:
Code Sample

# SSHHOST shows the arp table, grepping it for the line with the ip address you are shhing from in, then cuts the hostname out
[ -n "$SSH_CLIENT" ] && SSHHOST=$(arp -a | grep `echo $SSH_CLIENT|cut -f1 -d\ ` | cut -f1 -d\ )

# Creating command prompt, using SSHHOST to add dynamic host name to prompt if SSHing in
# PS1 = [Cyan/Underlined](Host where you are SSHing from)[No Color][Blue](SHHing through)[Light Red/Bold](User AT host:PWD)(Space)[No Color]
[ -n "$SSHHOST" ] && PS1=$'\\[\E[36;0;4m\\]$SSHHOST\\[\E[0m\\]\\[\E[36;0m\\]*\\[\E[31;1m\\]\\u@\\h:\\w \\[\E[0m\\]'

remotehostname*dslusername@dslhostname:path
OSX*dsl@box:~
OSX*dsl@box:~ cd /var/tmp
OSX*dsl@box:/var/tmp  

OSx would be underlined and blue, * would be blue, and dsl@box:~ would be light red.

I didn't make one for root yet (Don't really spend much time as root, so the plain jane prompt is warning enough)
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: July 23 2008,04:06 QUOTE

curaga: you have that smiley on the end as well? j/k :P  I did include some date details before, but I found that (at least on the systems I work on) that there was a permanent section for that already.

mikshaw: I was really wondering why it looked like such an odd prompt, until I tried it in a terminal and found out it was tux!

chaostic: very similar to the defaults but interesting use of the remote session.  I was looking for something that would separate during selection though.

In addition, booting in 4.x into user text-mode gives an aqua PS1 of "dsl@tty1[currentdirectorybasename]$", and similarily for root.

That brings me to (change) my question: would it be worth it to push for a default change in DSL to something that would allow "easy double-clicking" or should it be left alone since it seems everyone (who wants something like that, or more) customizes their own prompt anyways?
Back to top
Profile PM 
6 replies since July 22 2008,18:28 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: Change $PS1

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code