Thanks to Jack Wallen for prompt info!
Ever since SuSE said "bash$" I realized Unixy OSs were their own world. Linuxmag started w a Newbies column then gave up on the mass of Windose haters, leaving Linux opaque.
Jack's goofs.
1. Typo ERR: 2nd section "\[" (Not\]) starts.
2. A little colorful explaination, please? What IS the ColorCode?!
Your Primaries Color Codes suffix m :
R= 31m= 1F= 0001 1111
G= 32m= 20= 0010 0001
R= 34m= 22= 0010 0010
Huh? Sometimes I see iirrggbb 8-bit string. That gives 2^2= 4 levels of each primary and 4 intensities.
Discussion on:
View:
Show:
I use bash command windows for my daily work and I would like to customise the shell prompt to solve a problem I am facing. The issue is that I tend to create a lot of folders and subfolders and as I go "deeper and deeper" in the hierarchy tree, the shell prompt increases in length up to a point where it exceeds the window width and it jumps to the next line. I find this a bit annoying and I would like to know if I can customise the prompt so that it displays the last 3 directories for any place nested in more than 3 directories.
example:
% cd dir1
dir1 % cd dir1.1
dir1/dir1.1 % cd dir1.1.1
dir1/dir1.1/dir1.1.1 % cd dir1.1.1.1
dir1.1/dir1.1.1/dir1.1.1.1 %
I did use in the past tcsh command window and the command looked like:
alias setbar 'set d = $cwd;
set a = (`echo $cwd | tr "/" " "`);
@ n = $#a;
@ nn = 0;
@ nnn = 0;
if ( $n > 3 ) @ nn = $n - 1;
if ( $n > 3 ) @ nnn = $n - 2;
if ( $n > 3 ) set d = "${a[$nnn]}/${a[$nn]}/${a[$n]}";
set prompt = "${hostname}: $d % ";
unset n nn nnn a d'
example:
% cd dir1
dir1 % cd dir1.1
dir1/dir1.1 % cd dir1.1.1
dir1/dir1.1/dir1.1.1 % cd dir1.1.1.1
dir1.1/dir1.1.1/dir1.1.1.1 %
I did use in the past tcsh command window and the command looked like:
alias setbar 'set d = $cwd;
set a = (`echo $cwd | tr "/" " "`);
@ n = $#a;
@ nn = 0;
@ nnn = 0;
if ( $n > 3 ) @ nn = $n - 1;
if ( $n > 3 ) @ nnn = $n - 2;
if ( $n > 3 ) set d = "${a[$nnn]}/${a[$nn]}/${a[$n]}";
set prompt = "${hostname}: $d % ";
unset n nn nnn a d'
- Keyboard Shortcuts:
- Prev
- Next
- Toggle

































