On 7/15/05, Ben Horowitz <[EMAIL PROTECTED]> wrote:
> I grew to appreciate one feature of tcsh: the ability to use
> the commands pushd -v, and popd -v.
>
> As you know, when the bash pushd and popd commands are successful,
> they print the directory stack.  In tcsh, one can additionally issue
> the command pushd -v, which is like the bash commands pushd followed
> by dirs -v.  This feature appears not to be available in bash.
>
>   tcsh> pushd -v /tmp
>   0       /tmp
>   1       /

Does this do the trick?

pushd ()
{
    local verbose=0;
    if [ "$1" = "-v" ]; then
        verbose=1;
        shift;
    fi;
    builtin pushd "$@";
    if [ $verbose -eq 1 ]; then
        for w in [EMAIL PROTECTED];
        do
            echo "$w    ${DIRSTACK[$w]}";
        done;
    fi
}

Barely tested (and with bash 3.0 at that), but it seems to do
what you want.  popd would be very similar, of course.

Dave


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to