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

NAME

12       hash — remember or report utility locations
13

SYNOPSIS

15       hash [utility...]
16
17       hash -r
18

DESCRIPTION

20       The hash utility shall affect the way  the  current  shell  environment
21       remembers  the  locations  of  utilities  found as described in Section
22       2.9.1.1, Command Search and  Execution.   Depending  on  the  arguments
23       specified,  it  shall  add  utility locations to its list of remembered
24       locations or it shall purge the contents of the list. When no arguments
25       are specified, it shall report on the contents of the list.
26
27       Utilities  provided  as built-ins to the shell shall not be reported by
28       hash.
29

OPTIONS

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

OPERANDS

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

STDIN

46       Not used.
47

INPUT FILES

49       None.
50

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

80       Default.
81

STDOUT

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

STDERR

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

OUTPUT FILES

94       None.
95

EXTENDED DESCRIPTION

97       None.
98

EXIT STATUS

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

CONSEQUENCES OF ERRORS

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

APPLICATION USAGE

112       Since hash affects the  current  shell  execution  environment,  it  is
113       always provided as a shell regular built-in. If it is called in a sepa‐
114       rate utility execution environment, such as one of the following:
115
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
131           PATH="$PATH"
132
133       The use of hash with utility names is  unnecessary  for  most  applica‐
134       tions,  but  may provide a performance improvement on a few implementa‐
135       tions; normally, the hashing process is included by default.
136

EXAMPLES

138       None.
139

RATIONALE

141       None.
142

FUTURE DIRECTIONS

144       None.
145

SEE ALSO

147       Section 2.9.1.1, Command Search and Execution
148
149       The Base Definitions volume of  POSIX.1‐2017,  Chapter  8,  Environment
150       Variables, Section 12.2, Utility Syntax Guidelines
151
153       Portions  of  this text are reprinted and reproduced in electronic form
154       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
155       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
156       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
157       Electrical  and  Electronics Engineers, Inc and The Open Group.  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.opengroup.org/unix/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                  2017                             HASH(1P)
Impressum