nmh-workers
[Top][All Lists]
Advanced

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

Re: [Nmh-workers] Re: mhpath


From: Jon Steinhart
Subject: Re: [Nmh-workers] Re: mhpath
Date: Thu, 03 Nov 2005 11:12:56 -0800

> > 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?
> 
>     address@hidden:878]$ mhparam Current-Folder
>     address@hidden:879]$ echo $?
>     1
>     address@hidden:880]$ folder +lists
>     lists+ has no messages       ;        (others).
>     address@hidden:881]$ mhparam Current-Folder
>     lists
>     address@hidden: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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]