[comp.sys.ibm.pc] 4DOS can do 'cd -' !!

pnl@hpfinote.HP.COM (Peter Lim) (05/06/90)

Someone suggested how to implement 'cd -' as swd (see below) under 4DOS.
I tried it; it works and I went one step further and alias 'cd' so that
'cd -' will do the same as it does under UNIX.

Just place the following 2 lines in file XXXX and do alias /R XXXX under
4DOS and you're in business. It will work across drives.

swd	set _d1=%_cwd^popd^set _d2=%_cwd^*cdd %_d1^pushd %_d2^unset _d1 _d2
cd	iff "%1"=="-" then swd^elseiff "%1"=="" then *cd^else *pushd %1^endiff


One minor bug, it doesn't track where you're going when you change drive
without using 'cd' (ie. when you do 'e:' or 'c:' etc). Anyone one to fix
that too ?


Regards,                       ## Life is fast enough as it is ........
Peter Lim.                     ## .... DON'T PUSH IT !!          >>>-------,
                               ########################################### :
E-mail:  plim@hpsgwg.HP.COM     Snail-mail:  Hewlett Packard Singapore,    :
Tel:     (065)-279-2289                      (ICDS, ICS)                   |
Telnet:        520-2289                      1150 Depot Road,           __\@/__
  ... also at: pnl@hpfipnl.HP.COM            Singapore   0410.           SPLAT !

consp06@bingsuns.cc.binghamton.edu (Robert Konigsberg) (05/08/90)

What is swd?  I don't seen to understand the benefits of what you've
picked up.  No offense, just want to know what you've discovered, etc..

				-Rob Konigsberg

pnl@hpfinote.HP.COM (Peter Lim) (05/10/90)

> What is swd?  I don't seen to understand the benefits of what you've
> picked up.  No offense, just want to know what you've discovered, etc..
> 
> 				-Rob Konigsberg

Very simple ! swd is "swap directory stack". My great discovery is that
I can go one step further (instead of typing swd on the command line;
which requires me to remember a different command than the UNIX
environment) and alias 'cd' such that 'cd -' will do 'swd' and you
don't need to use pushd to get around to be able to back track since
the new alised 'cd' will do that for you.

To see the effect, run 4DOS 3.0, put the two lines I posted into a
file say 'xxxx'. Then do a 'alias /R xxxx'. From here on, do a few
'cd' around and try a few 'cd -'.


Regards,                       ## Life is fast enough as it is ........
Peter Lim.                     ## .... DON'T PUSH IT !!          >>>-------,
                               ########################################### :
E-mail:  plim@hpsgwg.HP.COM     Snail-mail:  Hewlett Packard Singapore,    :
Tel:     (065)-279-2289                      (ICDS, ICS)                   |
Telnet:        520-2289                      1150 Depot Road,           __\@/__
  ... also at: pnl@hpfipnl.HP.COM            Singapore   0410.           SPLAT !