Forum: DSL Ideas and Suggestions
Topic: Change $PS1
started by: ^thehatsrule^
Posted by ^thehatsrule^ on July 22 2008,18:28First of all, you may ask what is $PS1 - it is the primary prompt that you see in a terminal, such as:
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.
Posted by curaga on July 22 2008,19:08It'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.
Posted by mikshaw on July 22 2008,21:24I 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"
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)
Posted by chaostic on July 22 2008,21:35on OSx:
chaostic@OSX:~ cd 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:
OSX*dsl@box:~ cd /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)
Posted by ^thehatsrule^ on July 23 2008,04:06curaga: 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?
Posted by curaga on July 23 2008,08:44Yeah, there's a smiley. My PS2 prompt is " ". I work in terminal quite a lot, I like it, and don't want it to look boring, or like DOS.
For a default, a plain prompt is fine, everyone who wants change can find dozens of howtos about it anyway.
Posted by mikshaw on July 23 2008,13:43^thehatsrule^: On the subject of double-click select, I have occasionally had the need to get the current directory as a selection, but not more than occasionally. There is no other info in my prompt. I had at one time used \$PWD instead of \w in order to replace the tilde with /home/dsl. I have no idea if there is any difference in resource use between the two, but for some reason I went back to \w