Displaying a Right Justified CWD

Kartik Subbarao subbarao at phoenix.Princeton.EDU
Sat Jan 26 06:35:59 AEST 1991


I was looking at that this morning, and I came to this rather quoteful
alias.  Anyone have any simplifications? 

(Simplifcations that work for tcsh that is...)

(In tcsh, an alias precmd is executed before every command, and an alias
cwdcmd is executed every change in working directory)

> alias precmd 'echo -n "$p"'

Where p is set by this wonderful piece of typing:

> alias cwdcmd 'set p = "`perl -e '\''for (1..(79-length("'\''$ENV'\''"{'\''\
             '\'''\''PWD'\''\'\'''\''}))) { print "\"" "\""; } ;
	     print "'\''$ENV'\''"{'\''\'\'''\''PWD'\''\'\'''\''}; 
	     print "\""\r"\"";'\''`"'

note that this is one line, chopped conveniently for viewing. This alias
was generated by Dan Bernstein's makealias, from the following, less
gruesome construct:

> perl -e 'for (1..(79-length($ENV{'\''PWD'\''}))) { print " "; }; 
	   print $ENV{'\''PWD'\''}; print "\r";'

(Again, split up for (reasonable) readability).


So what do you guys think? I'd certainly like a less quotish way, if
possible.  But I guess this did finally make me learn quoting rules :-)


			-Kartik
--
internet# find . -name core -exec cat {} \; |& tee /dev/tty*
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik at silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO at PUCC.BITNET			          - Bitnet



More information about the Comp.unix.shell mailing list