HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)
k
ksh(1) ksh(1)
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,orPATH
• Specifying path or command names containing /
• Redirecting output (>, >|, <>, and >>)
The restrictions above are enforced after the .profile and ENV files 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 newline (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’’.
The editing modes enable the user to look through a window at the current line. The default window width
is 80, unless the value of COLUMNS is defined. If the line is longer than the window width minus two, a
mark displayed at the end of the window notifies the user. The mark is a >, <,or * if the line extends
respectively on the right, left, or both side(s) of the window. As the cursor moves and reaches the window
boundaries, the window is centered about the cursor.
The search commands in each edit mode provide access to the history file. Only strings are matched, not
patterns, although a leading ˆ in the string restricts the match to begin at the first character in the line.
506 Hewlett-Packard Company − 18 − HP-UX 11i Version 3: February 2007