PS1
which renders current working directory with colors and abbreviate directory names. Today, I recoded it a bit.Screenshot on top is the old one. You can see this diff view of my
.bashrc
. Generally, the newer one has same result, I only added color to the ~
. I used the newer Bash syntax [[]]
and (())
instead of the old test []
.My original plan was to use C code, unfortunately, those escape code,
\[
, \]
, or \e
, must not be from $variable
or results from subshell, they have to be apparent strings in PS1
. If you know how to resolve this issue, please let me know. If you only want to shorten PWD
and do not need these fancy colors, there is an one-liner version.Two and a half years, many things have changed, you just can see from the screenshots. I have switched to Gentoo from Fedora, GNOME to Fluxbox, GNOME Terminal to urxvt, GNU/Screen to tmux (this didn't show in screenshot), eyecandy (Compiz Fusion, IIRC) to plain, mainly use CLI. I used to run
su -
, now I just sudo
. And the kernel version from 2.6.23 to 2.6.32.Many things have changed.