1HASH(1P) POSIX Programmer's Manual HASH(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 hash - remember or report utility locations
13
15 hash [utility...]
16
17 hash -r
18
19
21 The hash utility shall affect the way the current shell environment
22 remembers the locations of utilities found as described in Command
23 Search and Execution . Depending on the arguments specified, it shall
24 add utility locations to its list of remembered locations or it shall
25 purge the contents of the list. When no arguments are specified, it
26 shall report on the contents of the list.
27
28 Utilities provided as built-ins to the shell shall not be reported by
29 hash.
30
32 The hash utility shall conform to the Base Definitions volume of
33 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
34
35 The following option shall be supported:
36
37 -r Forget all previously remembered utility locations.
38
39
41 The following operand shall be supported:
42
43 utility
44 The name of a utility to be searched for and added to the list
45 of remembered locations. If utility contains one or more
46 slashes, the results are unspecified.
47
48
50 Not used.
51
53 None.
54
56 The following environment variables shall affect the execution of hash:
57
58 LANG Provide a default value for the internationalization variables
59 that are unset or null. (See the Base Definitions volume of
60 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
61 ables for the precedence of internationalization variables used
62 to determine the values of locale categories.)
63
64 LC_ALL If set to a non-empty string value, override the values of all
65 the other internationalization variables.
66
67 LC_CTYPE
68 Determine the locale for the interpretation of sequences of
69 bytes of text data as characters (for example, single-byte as
70 opposed to multi-byte characters in arguments).
71
72 LC_MESSAGES
73 Determine the locale that should be used to affect the format
74 and contents of diagnostic messages written to standard error.
75
76 NLSPATH
77 Determine the location of message catalogs for the processing of
78 LC_MESSAGES .
79
80 PATH Determine the location of utility, as described in the Base Def‐
81 initions volume of IEEE Std 1003.1-2001, Chapter 8, Environment
82 Variables.
83
84
86 Default.
87
89 The standard output of hash shall be used when no arguments are speci‐
90 fied. Its format is unspecified, but includes the pathname of each
91 utility in the list of remembered locations for the current shell envi‐
92 ronment. This list shall consist of those utilities named in previous
93 hash invocations that have been invoked, and may contain those invoked
94 and found through the normal command search process.
95
97 The standard error shall be used only for diagnostic messages.
98
100 None.
101
103 None.
104
106 The following exit values shall be returned:
107
108 0 Successful completion.
109
110 >0 An error occurred.
111
112
114 Default.
115
116 The following sections are informative.
117
119 Since hash affects the current shell execution environment, it is
120 always provided as a shell regular built-in. If it is called in a sepa‐
121 rate utility execution environment, such as one of the following:
122
123
124 nohup hash -r
125 find . -type f | xargs hash
126
127 it does not affect the command search process of the caller's environ‐
128 ment.
129
130 The hash utility may be implemented as an alias-for example, alias
131 -t -, in which case utilities found through normal command search are
132 not listed by the hash command.
133
134 The effects of hash -r can also be achieved portably by resetting the
135 value of PATH ; in the simplest form, this can be:
136
137
138 PATH="$PATH"
139
140 The use of hash with utility names is unnecessary for most applica‐
141 tions, but may provide a performance improvement on a few implementa‐
142 tions; normally, the hashing process is included by default.
143
145 None.
146
148 None.
149
151 None.
152
154 Command Search and Execution
155
157 Portions of this text are reprinted and reproduced in electronic form
158 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
159 -- Portable Operating System Interface (POSIX), The Open Group Base
160 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
161 Electrical and Electronics Engineers, Inc and The Open Group. In the
162 event of any discrepancy between this version and the original IEEE and
163 The Open Group Standard, the original IEEE and The Open Group Standard
164 is the referee document. The original Standard can be obtained online
165 at http://www.opengroup.org/unix/online.html .
166
167
168
169IEEE/The Open Group 2003 HASH(1P)