Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
k
ksh(1) ksh(1)
whence [-pv ] name ...
For each name, indicate how it would be interpreted if used as a command name. The -v
option produces a more verbose report. The -p option does a path search for name even if
name is an alias, a function, or a reserved word.
Invoking ksh
If the shell is invoked by exec (see exec(2)), and the first character of argument zero ($0)is-, the shell is
assumed to be a login shell and commands are read first from /etc/profile . The expression
${HOME:-.}/.profile is then evaluated and an attempt to open the resulting filename is made. If
the file is opened successfully, the file is read. Next, commands are read from the file named by performing
parameter substitution on the value of the environment parameter ENV, if the file exists. If the -s option
is not present and arg is, a path search is performed on the first arg to determine the name of the script to
execute. When running ksh with arg, the script arg must have read permission and any setuid and getgid
settings are ignored. Commands are then read as described below. The following options are interpreted
by the shell when it is invoked:
-c string If the -c option is present, commands are read from string.
-s If the -s option is present or if no arguments remain, commands are read from the
standard input. Shell output, except for the output of some of the Special Commands
listed above, is written to file descriptor 2.
-i If the -i option is present or if the shell input and output are attached to a terminal,
the shell is interactive. In this case SIGTERM is ignored (so that kill 0 does not
kill an interactive shell) and
SIGINT +1 is caught and ignored (so that wait is inter-
ruptible). In all cases,
SIGQUIT is ignored by the shell. (See signal(5).)
-r If the -r option is present, the shell is a restricted shell.
The remaining options and arguments are described under the set command above.
rksh Only
rksh is used to set up login names and execution environments where capabilities are more controlled
than those of the standard shell. The actions of rksh are identical to those of ksh, except that the follow-
ing are forbidden:
Changing directory (see cd(1))
Setting the value of
SHELL, ENV,or PATH
Specifying path or command names containing /
Redirecting output (>, >|, <>, and >>)
The restrictions above are enforced after the .profile and ENV les are interpreted.
When a command to be executed is found to be a shell procedure, rksh invokes ksh to execute it. Thus,
the end-user is provided with shell procedures accessible to the full power of the standard shell, while being
restricted to a limited menu of commands. This scheme assumes that the end-user does not have write and
execute permissions in the same directory.
When a shell procedure is invoked from
rksh, the shell interpreter specified with the #! magic inherits
all the restricted features of rksh. So, the shell procedures written for execution under rksh with the
intent of utilizing the full power of the standard shell should not specify an interpreter with #!.
These rules effectively give the writer of the .profile file complete control over user actions, by per-
forming guaranteed set-up actions and leaving the user in an appropriate directory (probably not the login
directory).
The system administrator often sets up a directory of commands (usually
/usr/rbin) that can be safely
invoked by
rksh. HP-UX systems provide a restricted editor red (see ed(1)), suitable for restricted users.
COMMAND-LINE EDITING
In-line Editing Options
Normally, each command line typed at a terminal device is followed by a new-line (carriage-return or line-
feed). If either the
emacs, gmacs,or vi option is set, the user can edit the command line. An editing
option is automatically selected each time the VISUAL or EDITOR variable is assigned a value ending in
either of these option names.
The editing features require that the user’s terminal accept Return as carriage return without line feed and
that a space character must overwrite the current character on the screen. ADM terminal users should set
the ‘‘space/advance’’ switch to ‘‘space’’. Hewlett-Packard terminal users should set the straps to
‘‘bcGHxZ etX’’.
Section 1412 17 HP-UX Release 11i: December 2000
___
___