Wednesday, January 17, 2007

PS1 variable

oh yeah, the code

#new prompt by jiacobucci 01/15/07
PS1="$jiyellow\u$jicyan@$jiyellow\h$jired|$jiyellow\d$jired|$jiyellow\@$jired|$jiyellow\!$jired|$jiwhite\w\$ $jinorm"

for your favorite bash prompting needs.

By the way, the command "../../sim-outorder -config config_512_1_8_1_512_8.cfg mat_un >& temp.text && grep IPC" is longer than 80 characters. I don't know what size of console you use, but I tend to stick to 80*25. You would suffer from line wrap anyway. Also, you can add a newline at the end of the prompt, then it would always be "virgin" so that you can make your long commands.


Anonymous said...

Why are so many of those fields necessary? Date, time, and command number don't seem like they have much value to anyone no matter how long they leave their terminal unattended. State of a shell is a function of file system, environment variable values, and running tasks (none of which are presented in the prompt).

Most usage patterns I've witnessed don't require this information often enough to warrant inclusion in the prompt string. Is there something important that I'm missing? If so, paste some terminal histories that demonstrate it.

The colors are excellent.

For reference, the andykerr prompt string is:

[akerr](0)$ cat .bash_profile
cd ~/httpdocs
PS1="[\u](\j) \W$ "

Anonymous said...

You really stick to 80x25 characters? You miss out on perhaps a whole additional window of text above that, and you spend over 40 on the prompt repeating information that doesn't change very often and is needed even less frequently. That seems like an odd restriction.

Then again, I suppose there isn't a great reason to have a large console if it launches windowed applications, and commands are fairly short.

To each their own.

sstc said...

I can have a bigger window, but many programs were designed for 80*25 and display poorly on other sizes. I connect to a few boxes from my computer, and not having each one be huge is nice. I do use sizes bigger when I use lets say, w3m.

I noticed that you are not a system administrator. I use the date/time to figure out when I last ran the update manager. I don't want to cron it, because there have been instances where the update was deployed wrong. It only has to happen once to not want it be automated. It was fixed very quickly, but luckily, I didn't even notice because I decided when to update.

I have connection times that go into weeks or months. I use screen so that I basically keep one session all of the time. I tend to remember stuff by _when_ I did it. I can easily scroll back one month, instead of scrolling up (and reading each prompt) or searching for something specific. Different people have different mental models of information.

I used to use \j, but since I started using screen, I just open a screen for any programs or groups of programs I want separated. Then I can just look at the screen window list to go to what I want, or use the hot keys. Its basically like a window taskbar (but you can have a bunch of programs running within a "task")

sstc said...

Also, I use it to keep track of how long it takes to run a program. Its a poor man's tic/toc.