CSH script help needed

Dave Long toml at oliveb.UUCP
Tue Jan 10 14:49:47 AEST 1984


    Actually, if you're going to do this, and you are using 4.1BSD this
following stack-oriented command should provide a better arrangement.

In the .login or equivalent:
    set dsp=0
    set dr=""
    set ds=(. . . . . . . . . . . . . . . .)
In the .cshrc or equivalent:
    alias pushd   'set dr=\!*;cd $dr;@ dsp++;set ds[$dsp]=$dr'
    alias popd    'set ds[$dsp]=".";@ dsp--;set dr=$ds[$dsp];cd $dr'
    alias printd  'echo $ds'

    a sample session is as follows: (the '> ' is the prompt)
> pwd
/usr/foo
> pushd /usr/bletch
> printd
/usr/bletch . . . . . . . . . . . . .
> pwd
/usr/bletch
> pushd /usr/bletch/bar
> printd
/usr/bletch /usr/bletch/bar . . . . . . . . . .
> pwd
/usr/bletch/bar
> popd
> pwd
/usr/bletch
    .
    .
    .
						Dave Long
					{ucbvax,decvax}!decwrl!ios!oliveb!toml



More information about the Comp.unix.wizards mailing list