[comp.sys.ibm.pc] swapd vs. cd

msschaa@cs.vu.nl (Schaap MS) (05/02/90)

In 4DOS say:

alias swapd=`set d1=%_cwd^popd^set d2=%_cwd^cd %d1^pushd %d2^unset d1 d2`

Michael

toma@tekgvs.LABS.TEK.COM (Tom Almy) (05/03/90)

In article <6426@star.cs.vu.nl> msschaa@cs.vu.nl (Schaap MS) writes:
>In 4DOS say:
>alias swapd=`set d1=%_cwd^popd^set d2=%_cwd^cd %d1^pushd %d2^unset d1 d2`


Darn! It's so obvious :-). I would suggest using "cdd" instead of "cd" since
pushd/popd will change drives, too. Another possibility, which is more csh-like
is to allow for "pushd", no arguments, to swap:

alias pushd=`iff "%1"=="" then^set d1=%_cwd^popd^set d2=%_cwd^cd %d1^*pushd %d2^unset d1 d2^else^*pushd %1^endiff`

I haven't tried this yet, but it should work.

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply