1HASH(1P)                   POSIX Programmer's Manual                  HASH(1P)
2
3
4

PROLOG

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
11

NAME

13       hash — remember or report utility locations
14

SYNOPSIS

16       hash [utility...]
17
18       hash −r
19

DESCRIPTION

21       The hash utility shall affect the way  the  current  shell  environment
22       remembers  the  locations  of  utilities  found as described in Section
23       2.9.1.1, Command Search and  Execution.   Depending  on  the  arguments
24       specified,  it  shall  add  utility locations to its list of remembered
25       locations or it shall purge the contents of the list. When no arguments
26       are specified, it 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

OPTIONS

32       The hash utility shall  conform  to  the  Base  Definitions  volume  of
33       POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
34
35       The following option shall be supported:
36
37       −r        Forget all previously remembered utility locations.
38

OPERANDS

40       The following operand shall be supported:
41
42       utility   The  name  of  a  utility to be searched for and added to the
43                 list of remembered locations. If utility contains one or more
44                 <slash> characters, the results are unspecified.
45

STDIN

47       Not used.
48

INPUT FILES

50       None.
51

ENVIRONMENT VARIABLES

53       The following environment variables shall affect the execution of hash:
54
55       LANG      Provide  a  default  value for the internationalization vari‐
56                 ables that are unset or null. (See the Base Definitions  vol‐
57                 ume  of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
58                 ables for the precedence  of  internationalization  variables
59                 used to determine the values of locale categories.)
60
61       LC_ALL    If  set  to  a non-empty string value, override the values of
62                 all the other internationalization variables.
63
64       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
65                 bytes of text data as characters (for example, single-byte as
66                 opposed to multi-byte characters in arguments).
67
68       LC_MESSAGES
69                 Determine the locale that should be used to affect the format
70                 and  contents  of  diagnostic  messages  written  to standard
71                 error.
72
73       NLSPATH   Determine the location of message catalogs for the processing
74                 of LC_MESSAGES.
75
76       PATH      Determine  the  location of utility, as described in the Base
77                 Definitions volume of POSIX.1‐2008,  Chapter  8,  Environment
78                 Variables.
79

ASYNCHRONOUS EVENTS

81       Default.
82

STDOUT

84       The  standard output of hash shall be used when no arguments are speci‐
85       fied. Its format is unspecified, but  includes  the  pathname  of  each
86       utility in the list of remembered locations for the current shell envi‐
87       ronment. This list shall consist of those utilities named  in  previous
88       hash  invocations that have been invoked, and may contain those invoked
89       and found through the normal command search process.
90

STDERR

92       The standard error shall be used only for diagnostic messages.
93

OUTPUT FILES

95       None.
96

EXTENDED DESCRIPTION

98       None.
99

EXIT STATUS

101       The following exit values shall be returned:
102
103        0    Successful completion.
104
105       >0    An error occurred.
106

CONSEQUENCES OF ERRORS

108       Default.
109
110       The following sections are informative.
111

APPLICATION USAGE

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           nohup hash −r
118           find . −type f | xargs hash
119
120       it does not affect the command search process of the caller's  environ‐
121       ment.
122
123       The  hash  utility  may  be  implemented as an alias—for example, alias
124       −t −, in which case utilities found through normal command  search  are
125       not listed by the hash command.
126
127       The  effects  of hash −r can also be achieved portably by resetting the
128       value of PATH; in the simplest form, this can be:
129
130           PATH="$PATH"
131
132       The use of hash with utility names is  unnecessary  for  most  applica‐
133       tions,  but  may provide a performance improvement on a few implementa‐
134       tions; normally, the hashing process is included by default.
135

EXAMPLES

137       None.
138

RATIONALE

140       None.
141

FUTURE DIRECTIONS

143       None.
144

SEE ALSO

146       Section 2.9.1.1, Command Search and Execution
147
148       The Base Definitions volume of  POSIX.1‐2008,  Chapter  8,  Environment
149       Variables, Section 12.2, Utility Syntax Guidelines
150
152       Portions  of  this text are reprinted and reproduced in electronic form
153       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
154       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
155       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
156       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
157       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
158       event of any discrepancy between this version and the original IEEE and
159       The Open Group Standard, the original IEEE and The Open Group  Standard
160       is  the  referee document. The original Standard can be obtained online
161       at http://www.unix.org/online.html .
162
163       Any typographical or formatting errors that appear  in  this  page  are
164       most likely to have been introduced during the conversion of the source
165       files to man page format. To report such errors,  see  https://www.ker
166       nel.org/doc/man-pages/reporting_bugs.html .
167
168
169
170IEEE/The Open Group                  2013                             HASH(1P)
Impressum