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