mhpath - print full pathnames of nmh messages and folders
mhpath [-help] [-version] [+folder]
expands and sorts the message list `msgs' and writes the full
pathnames of the messages to the standard output, separated by newlines. If no
`msgs' are specified, mhpath
outputs the current mail folder's pathname
instead. If the only argument is `+', your nmh
output; this can be useful in shell scripts.
In contrast with other nmh
commands, a message argument to mhpath
may often be intended for writing. Because of this:
- the name “new” has been added to mhpath's list of
reserved message names (the others are “first”,
“last”, “prev”, “next”,
“cur”, and “all”). The new message is
equivalent to the message after the last message in a folder (and
equivalent to 1 in a folder without messages). The “new”
message may not be used as part of a message range.
- Within a message list, the following designations may refer to messages
that do not exist: a single numeric message name, the single message name
“cur”, and (obviously) the single message name
“new”. All other message designations must refer to at least
one existing message, if the folder contains messages.
- An empty folder is not, in itself, an error.
A message number less than that of the smallest existing message in a folder is
treated as if the message already exists. A message number greater than that
of the highest existing message in a folder causes an “out of
range” error message to be displayed.
As part of a range designation that contains messages that do exist, message
numbers less than the smallest, or greater than the highest, existing message
in a folder are ignored.
Examples: The current folder foo contains messages 3 5 6. Cur is 4.
% mhpath all
% mhpath 2001
mhpath: message 2001 out of range 1-6
% mhpath 1-2001
% mhpath new
% mhpath last new
% mhpath last-new
mhpath: bad message list last-new
% mhpath cur
% mhpath 1-2
mhpath: no messages in range 1-2
% mhpath first:2
% mhpath 1 2
is also useful in backquoted operations:
% cd `mhpath +inbox`
% echo `mhpath +`
expands and sorts [msgs
]. the command
to will not move 501 to 500; quite the reverse. But
mv `mhpath 501` `mhpath 500`
will do the trick.
Out-of-range message 0 produces a different error message than large
out-of-range message numbers. But both cause mhpath
to exit with
^$HOME/.mh_profile~^The user profile
^Path:~^To determine the user's nmh directory
^Current-Folder:~^To find the default current folder
`+folder' defaults to the current folder
`msgs' defaults to none