DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

hash(C)


hash -- remember, report, or forget command locations

Syntax

hash [ command ... ]

hash -r

Description

hash affects the way the current shell environment remembers the locations of commands. hash adds the pathnames of the specified commands to its hash list.

Used on its own, with no options or arguments, hash reports the contents of its list.

The -r option makes hash forget the contents of the list. If you change the environment variable PATH, hash forgets its list until you reference a command at a later time.

Examples

Store the pathname of the vi(C) command in the hash list:

hash vi

The command hash might show the following hash list:

   cp=/bin/cp
   grep=/bin/grep
   ls=/bin/ls
   rm=/bin/rm
   vi=/usr/bin/vi

Exit values

hash returns the following values:

0
successful completion

>0
an error occurred

Limitations

hash is implemented as a built-in command in the Korn shell.

hash does not report commands provided as built-ins to the shell.

Using hash with command names is unnecessary for most applications. It may provide a performance improvement, obviating the need to use $PATH to search for the location of a given command.

See also

ksh(C)

Standards conformance

hash is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003