subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (01/26/91)
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@silvertone.Princeton.EDU (NeXT mail) -| SUBBARAO@PUCC.BITNET - Bitnet
byron@archone.tamu.edu (Byron Rakitzis) (01/26/91)
In article <5708@idunno.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes: > >I was looking at that this morning, and I came to this rather quoteful >alias. Anyone have any simplifications? > (alias shown here:) > >> alias cwdcmd 'set p = "`perl -e '\''for (1..(79-length("'\''$ENV'\''"{'\''\ > '\'''\''PWD'\''\'\'''\''}))) { print "\"" "\""; } ; > print "'\''$ENV'\''"{'\''\'\'''\''PWD'\''\'\'''\''}; > print "\""\r"\"";'\''`"' > Yes. Stop using the C-shell and save yourself from brain-death. (not only is this hideous, but it invokes perl!! As was quoted on the net recently: "a system without perl is like a hockey game without a fight" ) Byron. -- Byron Rakitzis byron@archone.tamu.edu
merlyn@iwarp.intel.com (Randal L. Schwartz) (01/26/91)
In article <5708@idunno.Princeton.EDU>, subbarao@phoenix (Kartik Subbarao) writes: | 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 :-) perl -e 'printf "%79s\r", $ENV{"PWD"}' The right tool for the right job. :-) print "Just another Perl [book] hacker,"# :-) -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/