1MHPATH(1) General Commands Manual MHPATH(1)
2
3
4
6 mhpath - print full pathnames of nmh messages and folders
7
9 mhpath [-help] [-version] [+folder] [msgs]
10
12 mhpath expands and sorts the message list `msgs' and writes the full
13 pathnames of the messages to the standard output, separated by new‐
14 lines. If no `msgs' are specified, mhpath outputs the current mail
15 folder's pathname instead. If the only argument is `+', your nmh
16 “Path” is output; this can be useful in shell scripts.
17
18 In contrast with other nmh commands, a message argument to mhpath may
19 often be intended for writing. Because of this:
20
21 1) the name “new” has been added to mhpath's list of reserved message
22 names (the others are “first”, “last”, “prev”, “next”, “cur”, and
23 “all”). The new message is equivalent to the message after the
24 last message in a folder (and equivalent to 1 in a folder without
25 messages). The “new” message may not be used as part of a message
26 range.
27
28 2) Within a message list, the following designations may refer to mes‐
29 sages that do not exist: a single numeric message name, the single
30 message name “cur”, and (obviously) the single message name “new”.
31 All other message designations must refer to at least one existing
32 message, if the folder contains messages.
33
34 3) An empty folder is not, in itself, an error.
35
36 A message number less than that of the smallest existing message in a
37 folder is treated as if the message already exists. A message number
38 greater than that of the highest existing message in a folder causes an
39 “out of range” error message to be displayed.
40
41 As part of a range designation that contains messages that do exist,
42 message numbers less than the smallest, or greater than the highest,
43 existing message in a folder are ignored.
44
45 Examples: The current folder foo contains messages 3 5 6. Cur is 4.
46
47 % mhpath
48 /r/phyl/Mail/foo
49
50 % mhpath all
51 /r/phyl/Mail/foo/3
52 /r/phyl/Mail/foo/5
53 /r/phyl/Mail/foo/6
54
55 % mhpath 2001
56 mhpath: message 2001 out of range 1-6
57
58 % mhpath 1-2001
59 /r/phyl/Mail/foo/3
60 /r/phyl/Mail/foo/5
61 /r/phyl/Mail/foo/6
62
63 % mhpath new
64 /r/phyl/Mail/foo/7
65
66 % mhpath last new
67 /r/phyl/Mail/foo/6
68 /r/phyl/Mail/foo/7
69
70 % mhpath last-new
71 mhpath: bad message list last-new
72
73 % mhpath cur
74 /r/phyl/Mail/foo/4
75
76 % mhpath 1-2
77 mhpath: no messages in range 1-2
78
79 % mhpath first:2
80 /r/phyl/Mail/foo/3
81 /r/phyl/Mail/foo/5
82
83 % mhpath 1 2
84 /r/phyl/Mail/foo/1
85 /r/phyl/Mail/foo/2
86
87 mhpath is also useful in backquoted operations:
88
89 % cd `mhpath +inbox`
90
91 % echo `mhpath +`
92 /r/phyl/Mail
93
94 Because mhpath expands and sorts [msgs]. the command
95
96 mv `mhpath 501 500`
97
98 to will not move 501 to 500; quite the reverse. But
99
100 mv `mhpath 501` `mhpath 500`
101
102 will do the trick.
103
104 Out-of-range message 0 produces a different error message than large
105 out-of-range message numbers. But both cause mhpath to exit with non-
106 zero status.
107
109 $HOME/.mh_profile The user profile
110
112 Path: To determine the user's nmh directory
113 Current-Folder: To find the default current folder
114
116 folder(1)
117
119 `+folder' defaults to the current folder
120 `msgs' defaults to none
121
123 None
124
125
126
127nmh-1.7.1 2012-02-18 MHPATH(1)