[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "cdpath" searching, and pushd/popd too



> Myself, I have become addicted to pushd and popd, but I will not
> suggest adding them to es.  Indeed I find them somewhat painful to
> use, even though I use them frequently:  Getting back to a particular
> directory requires a `dirs' followed by careful counting to figure out
> which number to give to `pushd'.

I've got a ``bash''-compatible version of pushd/popd which can take negative
arguments so that you can count from the end of the dirstack if you wish.
This often means I don't have to count for more than 1 from either
direction.

> Oh, there is one problem with this, as well as with the classical
> pushd/popd, and with back to:  We have a system where lots of file
> system are NFS mounted using the automounter.  Now trying to cd back
> to a directory that I didn't visit for a while can easily fail, as I
> haven't save the version of the path that will trigger the automounter
> to remount the volume.  Any good solutions for that one?

No problems, use this version of pwd which will strip out the automounter
directory (/auto in my case), and all this without calling external programs
like sed.  Hint I don't want %split etc. removed :-) !

let (pwd = /bin/pwd)
        fn pwd {        # function to strip off the /auto from pwd
                let (t = `{$pwd}) {
                        ~ $t () && return 1
                        ~ $t /auto* && {t = <={%split / $t};
                                        t = / ^ <={%flatten / $t(2 ...)}}
                        echo $t
                }
        }


Pete.