Built-in String Processing?

Joe Smith jms at tardis.Tymnet.COM
Wed Oct 31 10:04:28 AEST 1990


In article <1990Oct27.215051.14085 at midway.uchicago.edu> phd_ivo at gsbacd.uchicago.edu writes:
>	alias cd                'cd \!* && set prompt="\! ${cwd}> "'
>Unfortunately, this gives me a rather long string.

Use $variable:t to get the tail (the name after the last "/") and use
$variable:h to get the head (everything before the last "/").

alias cd    'cd \!*; set cwdh=$cwd:h; set prompt="($cwdh:t/$cwd:t) $myprompt"'
alias pushd 'pushd \!*; cd .'
alias popd  'popd \!*; cd .'

Or go read the Frequently Asked Questions posting in the "newuser" and
"announce" newsgroups.
-- 
Joe Smith (408)922-6220 | SMTP: jms at tardis.tymnet.com or jms at gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."



More information about the Comp.unix.shell mailing list