pekka@miraculix.liu.se (Pekka Akselin [The Mad Midnight Hacker]) (04/22/88)
Hello! Is there anybody out there who had made pushd/popd compatible programs for UNIX-sysV. Would you share them with me? If so please send (preferably via email) copies of them to me! Thanks in advance. Bye. /pekka [...The Mad Midnight Hacker Strikes Again...] ______________________________________________________________________________ pak@ida.liu.se ...!uunet!enea!liuida!ida!pak Pekka Akselin, Univ. of Linkoping, Sweden (The Land Of The Midnight Hacker 8-) Bus error (core dumped)
kwb@hpmtlx.HP.COM (Keith Blackwell) (04/26/88)
> 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 programs can't do the job. So maybe what you really want is a more useful shell! Note: if your shell has command aliasing and array variables, you can build your own version of pushd/popd with aliases. Keith Blackwell hplabs!hpmtlkb!kwb BTW, I would be really interested (and surprised) in hearing about any exceptions to my explanation!
jfh@rpp386.UUCP (John F. Haugh II) (04/27/88)
In article <792@miraculix.liu.se> pekka@liuida.UUCP writes: > >Hello! >Is there anybody out there who had made pushd/popd compatible >programs for UNIX-sysV. Would you share them with me? >If so please send (preferably via email) copies of them to me! >Thanks in advance. >Bye. >-- > /pekka i don't see the difficulty in this. all you (basically) need is to use a variable to hold an array of directory names and create an alias to source the file. if this really is a Big Deal, i'll post the C-shell scripts i use at work. and if you want them a little earlier, send mail to me at ...!ihnp4!killer!rpp386!pigs!haugj telling me you want the directory stack stuff (pushd, popd, swapd) - john. -- John F. Haugh II | "You see, I want a lot. Perhaps I want every River Parishes Programming | -thing. The darkness that comes with every UUCP: ihnp4!killer!rpp386!jfh | infinite fall and the shivering blaze of DOMAIN: jfh@rpp386 | every step up ..." -- Rainer Maria Rilke
meissner@xyzzy.UUCP (Michael Meissner) (05/17/88)
In article <730001@hpmtlx.HP.COM> kwb@hpmtlx.HP.COM (Keith Blackwell) writes: | | 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 | programs can't do the job. So maybe what you | really want is a more useful shell! Note: if your shell | has command aliasing and array variables, you can build your own | version of pushd/popd with aliases. | Keith Blackwell | hplabs!hpmtlkb!kwb | BTW, I would be really interested (and surprised) in hearing about any | exceptions to my explanation! | One particularly grungy way of supporting pushd/popd just occurred to me. Basically pushd would spawn a subshell in the pushed directory. It would also stuff somewhere (like the environment) it's process id. Popd would then send a signal to popd, which would kill the subshell (and presumably popd). Each pushd would consume 1-2 processes, and you would have to do as many popd's as you did pushd's. Before you flame me, I did warn you it was grungy, and is more proof of concept. -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner Arpa: meissner@dg-rtp.DG.COM (or) meissner%dg-rtp.DG.COM@relay.cs.net
rwl@uvacs.CS.VIRGINIA.EDU (Ray Lubinsky) (05/17/88)
In article <875@xyzzy.UUCP>, meissner@xyzzy.UUCP (Michael Meissner) writes: > One particularly grungy way of supporting pushd/popd just occurred to > me. Basically pushd would spawn a subshell in the pushed directory. > It would also stuff somewhere (like the environment) it's process id. > Popd would then send a signal to popd, which would kill the subshell > (and presumably popd). Each pushd would consume 1-2 processes, and > you would have to do as many popd's as you did pushd's. Before you > flame me, I did warn you it was grungy, and is more proof of concept. Yup, that's grungy alright. Even with this, I don't see how you could emulate the full behavior of the C-shell's pushd/popd, namely the ability to "roll" the stack and selectively popd from the middle of the stack. I'm pretty sure that SYSV is not going to let you do the kind job control needed to continue the kludge with pushd/popd programs. Shells with functions are another matter; it's pretty straight-forward to emulate those builtins there. If anyone would like to see my Korn shell alias & function set for doing pushd/popd, let me know. If I get a few responses, I'll post. -- | Ray Lubinsky, UUCP: ...!uunet!virginia!uvacs!rwl | | Department of BITNET: rwl8y@virginia | | Computer Science, CSNET: rwl@cs.virginia.edu -OR- | | University of Virginia rwl%uvacs@uvaarpa.virginia.edu |
torsten@pcsbst.UUCP (Torsten) (05/19/88)
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 ? |/--------|--------\| -----------------------------------------------------------------------------