MHPATH(1mh)

πŸ“¦
version 1.8 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

mhpath β€” bestie, this one prints the full pathnames of your nmh messages and folders. That's it, that's the whole job, and it does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

mhpath [-help] [-version] [+folder] [msgs]

✨ DESCRIPTION ✨

Okay so here's the tea β˜•: mhpath takes your message list msgs, expands it and sorts it, then writes the full pathnames of those messages to standard output, separated by newlines. One per line, clean, iconic.

If you don't specify any msgs at all? Then mhpath just outputs the current mail folder's pathname instead. And if the only argument you give is +, you get your nmh "Path" printed out β€” which is genuinely so useful in shell scripts, no cap. 🫢

Now, here's the thing that makes mhpath different from every other nmh command: a message argument to mhpath may often be intended for writing. Because of that:

  1. The name new has been added to mhpath's list of reserved message names β€” the others being first, last, prev, next, cur, and all. The new message is equivalent to the message after the last message in a folder, and it's equivalent to 1 in a folder with no messages. Important: the new message may not be used as part of a message range.
  2. Within a message list, these 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. Every other message designation must refer to at least one existing message, if the folder contains messages.
  3. An empty folder is not, in itself, an error. Periodt. ✨

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. πŸ’€

And if it's 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 simply ignored. Slay.


πŸ¦‹ Examples, bestie πŸ¦‹

The current folder foo contains messages 3 5 6. Cur is 4.

$ mhpath
/r/phyl/Mail/foo

$ mhpath all
/r/phyl/Mail/foo/3
/r/phyl/Mail/foo/5
/r/phyl/Mail/foo/6

$ mhpath 2001
mhpath: message 2001 out of range 1-6

$ mhpath 1-2001
/r/phyl/Mail/foo/3
/r/phyl/Mail/foo/5
/r/phyl/Mail/foo/6

$ mhpath new
/r/phyl/Mail/foo/7

$ mhpath last new
/r/phyl/Mail/foo/6
/r/phyl/Mail/foo/7

$ mhpath last-new
mhpath: bad message list last-new

$ mhpath cur
/r/phyl/Mail/foo/4

$ mhpath 1-2
mhpath: no messages in range 1-2

$ mhpath first:2
/r/phyl/Mail/foo/3
/r/phyl/Mail/foo/5

$ mhpath 1 2
/r/phyl/Mail/foo/1
/r/phyl/Mail/foo/2

mhpath is also lowkey perfect for backquoted operations:

$ cd `mhpath +inbox`

$ echo `mhpath +`
/r/phyl/Mail

Because mhpath expands and sorts [msgs]. the command

mv `mhpath 501 500`

to will not move 501 to 500; quite the reverse. But

mv `mhpath 501` `mhpath 500`

will do the trick. πŸŽ€ (iykyk)


🚨 Out-of-range message 0 produces a different error message than large out-of-range message numbers. But both cause mhpath to exit with non-zero status. Both. Every time. Don't forget it.

πŸŽ€ FILES πŸŽ€

  • $HOME/.mh_profile β€” The user profile

πŸ’œ PROFILE COMPONENTS πŸ’œ

  • Path: β€” To determine the user's nmh directory
  • Current-Folder: β€” To find the default current folder

🌈 SEE ALSO 🌈


⭐ DEFAULTS ⭐

  • +folder defaults to the current folder
  • msgs defaults to none

🧚 CONTEXT 🧚

None


Okay that's the whole page, bestie β€” this one came from nmh-1.8, dated 2012-02-18, and it lives as MHPATH(1mh) in the manual. Go print some pathnames, you absolute main character. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from