Path: utzoo!attcan!uunet!mcvax!unido!pcsbst!torsten From: torsten@pcsbst.UUCP (Torsten) Newsgroups: comp.sources.wanted Subject: Re: BSD43 pushd/popd compatible progs on sysV Message-ID: <236@pcsbst.UUCP> Date: 19 May 88 11:45:45 GMT References: <792@miraculix.liu.se> <730001@hpmtlx.HP.COM> Reply-To: torsten@pcsbst.UUCP (Torsten Homeyer) Organization: PCS GmbH, Pfaelzer-Wald-Str. 36, 8000 Muenchen; West-Germany Lines: 40 Posted: Thu May 19 12:45:45 1988 In article <730001@hpmtlx.HP.COM> kwb@hpmtlx.HP.COM (Keith Blackwell) writes: > >> Is there anybody out there who had made pushd/popd compatible >> programs for UNIX-sysV. Would you share them with me? > >My understanding is that pushd and popd are commands built in to the >shell (csh only?) --- they *HAVE* to be built in since it is the shell's >working directory you want to change (stack-wise). Executable Here is a little script i once wrote for my Csh on a SYS III mashine which didn't support the directory stack mechanism. It was originally taken from a Xenix system, but i had to clean it up to make it usable. It should be easy to implement it in the Sh or Ksh if it supports shell-functions. Just put them in your .profile. # some BSD lookalikes if (! $?_d) set _d = () alias popd 'cd $_d[2]; shift _d;echo $_d' alias pushd 'set _d = (\!* $_d); cd \!*;echo $_d' alias swapd 'set _d = ($_d[2] $_d[1] $_d[3-]); cd $_d[1];echo $_d' alias lshfd 'set _d = ($_d $_d[1]); shift _d; cd $_d[1]; echo $_d' alias rshfd '@ I = ${#_d} - 1; set _d = ($_d[${#_d}] $_d[-$I]); cd $_d[1]; echo $_d' alias flipd 'pushd `pwd`; swapd ; popd' alias showd 'echo $_d' endif mfg Torsten. --- _____________________________________________________________________________ | Disclaimer : What the hell is an opinion ????????? |\--------|--------/| --------------------------------------------------------| \ | / | | Name : Torsten Homeyer | | \----|----/ | | | Company : PCS GmbH, Munich W-Germany | | \ | / | | | UUCP : |--|----->O<-----|--| | Company : ....uunet!unido!pcsbst!torsten | | / | \ | | | Privat : ....uunet!unido!homeyer!torsten | | /----|----\ | | --------------------------------------------------------| / | \ | | Who, what, where am I ? |/--------|--------\| -----------------------------------------------------------------------------