Path: utzoo!utgpu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!hwcs!scott From: scott@cs.hw.ac.uk (Scott Telford) Newsgroups: alt.sources Subject: Re: ksh emulation of dirs, pushd, and popd of csh Message-ID: <2374@odin.cs.hw.ac.uk> Date: 23 Feb 91 18:26:51 GMT References: <1947@seti.inria.fr> Sender: news@cs.hw.ac.uk Reply-To: scott@cs.hw.ac.uk (Scott Telford) Organization: Dept of Computer Science, Heriot-Watt University, UK. Lines: 38 In article <1947@seti.inria.fr> gh@bdblues.altair.fr (gilbert harrus) writes: >I just moved from [t]csh to ksh, and I wrote this "package" to learn more >about ksh. > >Save in a file, say dirs.ksh, and type : eval . dirs.ksh >Not extensively tested... > I did the same thing a while ago for Bourne Shell, basically because I use tcsh all the time on Unix systems, but the best Unix-style shell for DOS I've found is the Data Logic MS-DOS sh. As you can see, mine is a bit more compact than Gilbert's 8^)... It doesn't support the '+n' switch but it's just about as minimalist as you can get. Note that older Bourne Shells don't have shell functions. Share and enjoy. ------------------------------------------------------------------------------- #!bin/sh #pushd/popd/dirs for Bourne Shell with shell functions #Scott Telford, Dept of Comp Sci, Heriot-Watt Uni, 24-10-90 DIRSTACK=$HOME dirs() { echo $DIRSTACK ; } popd() { set - $DIRSTACK && shift && cd $1 && DIRSTACK=$@ && dirs ; } pushd() { cd $1 && DIRSTACK=`pwd`" "$DIRSTACK && dirs ; } ------------------------------------------------------------------------------- _____________________________________________________________________________ | Scott Telford, Dept of Computer Science, scott@cs.hw.ac.uk | | Heriot-Watt University, Edinburgh, UK. scott%hwcs@ukc.uucp | |_____ "Expect the unexpected." (The Hitch-Hiker's Guide to the Galaxy) ______| Brought to you by Super Global Mega Corp .com