hash(1)


hash -- remember or report utility locations

Synopsis

/u95/u95/bin/hash [utility ...]

/usr/bin/hash -r

Description

This shell script executes the builtin command of the same name as implemented by the /u95/bin/sh( ) shell. See ksh(1) for more information on this shell.

The hash command affects the way the current shell environment remembers the locations of utilities (see the ``Execution'' section of the ksh(1) manual page). Depending on the arguments specified, it adds utility locations to its list of remembered locations or it purges the contents of the list. When no arguments are specified, it reports on the contents of the list. Utilities provided as built-ins to the shell are not reported.

Flags

If the -r option is specified, the list of remembered locations for the current shell environment is emptied.

Operands

The utility operand specifies the name of a utility (without slashes) to be searched for and added to the list of remembered locations.

Environment variables

The following environment variables affect the execution of hash:

LANG
Provide a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL
If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).

LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

PATH
Used to determine the location of utility.

Output

The standard output of hash is used when no arguments are specified. It includes the pathname of each utility in the list of remembered locations for the current shell environment. This list consists of those utilities named in previous hash invocations that have been invoked.

Exit codes

An exit code of 0 indicates successful completion; an exit code greater than 0 indicates an error.

Usage

Since hash affects the current shell execution environment, if it is called in a separate utility execution environment, such as one of the following:

nohup hash -r
find . -type f | xargs hash

it will not affect the command search process of the caller's environment.

The hash command is implemented as an alias:

alias -t -

The effects of hash -r can also be achieved by resetting the value of PATH, such as in:

PATH="$PATH"

References

ksh(1), type(1)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005