whence

identify how KornShell interprets command name 

KornShell Built-in


SYNOPSIS

whence [-a] [-f] [-p] [-v] name ...


DESCRIPTION

whence identifies how the KornShell would interpret each name if used as a command name. Shell keywords, aliases, functions, built-in commands, and executable files are distinguished. For executable files, the path name of the file is given.

The main difference between whence and which is that whence is built into the shell and thus can take into account shell internal commands.

whence creates a tracked alias for each name that it identifies. For more information on tracked aliases, see the sh and alias reference pages.

Options

-a 

displays all interpretations for name.

-f 

does not check to see if the shell can interpret name as a function.

-p 

does not check to see if the shell can interpret name as a function, a shell keyword, a built-in command, or an alias.

-v 

gives a more verbose report.


ENVIRONMENT VARIABLES

PATHEXT 

contains a list of file extensions (separated by semicolons) for executable commands. Matching files with these extensions are searched for when the exact command name is not found. As the shell searches each directory in the search path, it appends each of the extensions in the list, in turn, to the command name and if it matches a file name in that directory, that file is executed as though it had that extension.

By default, PATHEXT, has the value of XP/2003/Vista/7/2008/8/2012's PATHEXT variable with .com;.exe;.bat;.sh;.ksh;.csh;.sed;.awk;.pl appended (omitting any extensions already represented in PATHEXT).

TK_WHENCE_HISTORICAL_BEHAVIOR 

when set, the -a option generates the same output as the -v. This was the historical behavior and while incorrect, it may be required for the backwards compatibility of scripts.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Command name could not be found.

2 

Failure due to an invalid command line argument.


PORTABILITY

Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.

On UNIX systems, whence is built into the KornShell, but is not in the Bourne Shell. It is an extension to the POSIX.2 and XPG standards.

See command for the POSIX.2 and XPG replacement.


NOTE

This command is built into the MKS KornShell.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Integrity


SEE ALSO

Commands:
alias, command, sh, which

Using the MKS KornShell


PTC MKS Toolkit 9.6 patch 1 Documentation Build 5.