nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Re: mhpath

2005-11-03 12:19:59
I have thought about this.  There are time where one really wants to
know THE current folder, which means none if there is none.

But there *is* a current folder if there isn't one in context, and
it's +inbox.

Why don't you use mhparam instead?

    [wohler@olgas:878]$ mhparam Current-Folder
    [wohler@olgas:879]$ echo $?
    1
    [wohler@olgas:880]$ folder +lists
    lists+ has no messages       ;        (others).
    [wohler@olgas:881]$ mhparam Current-Folder
    lists
    [wohler@olgas:882]$ echo $?
    0

There is only a current folder from the nmh perspective, not from the
perspective of another program trying to access something in the nmh
directory structure.

What you have above doesn't quite do the trick.  I guess that I will
agree with you that this can be done without a change to mhpath though.

        folder_name=`mhparam Current-Folder`

        if [ $? -ne 0 ]; then
                echo "No current folder."

        else
                folder_path=`mhpath +$folder_name`

                if [ -d "$folder_path" ]; then
                        echo "Current folder is $folder_name."
                else
                        echo "No current folder."
                fi
        fi

Pretty cumbersome.  Takes more code that the change to mhpath would
take.

Jon


_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>