
k
ksh(1) | ksh(1) |
execute the command using exec (see exec(2)).
The shell parameter PATH de®nes the search path for the directory containing the command. Alternative directory names are separated by a colon (:). The default path is /usr/bin: (specifying /usr/bin and the current directory in that order). Note that the current directory is speci®ed by a null path name which can appear immediately after the equals sign, between colon delimiters, or at the end of the path list. The search path is not used if the command name contains a /. Otherwise, each directory in the path is searched for an executable ®le. If the ®le has execute permissions but is not a directory or an executable object code ®le, it is assumed to be a script ®le, which is a ®le of data for an interpreter. If the ®rst two characters of the script ®le are #!, exec (see exec(2)) expects an interpreter path name to follow. exec then attempts to execute the speci®ed interpreter as a separate process to read the entire script ®le. If a call to exec fails, /usr/bin/ksh is spawned to interpret the script ®le. All
Command
The text of the last HISTSIZE (default 128) commands entered from a terminal device is saved in a history ®le. The ®le $HOME/.sh_history is used if the HISTFILE variable is not set or writable. A shell can access the commands of all interactive shells that use the same named HISTFILE. The special command fc is used to list or edit a portion of this ®le. The portion of the ®le to be edited or listed can be selected by number or by giving the ®rst character or characters of the command. A single command or range of commands can be speci®ed. If no editor program is speci®ed as an argument to fc, the value of the FCEDIT parameter is used. If FCEDIT is not de®ned, /usr/bin/ed is used. The edited command is printed and
The history ®le will be trimmed when all of the following conditions occurs:
Its size is greater than four kilobytes.
The number of commands in it is more than HISTSIZE.
The ®le has not been modi®ed in the last ten minutes.
The user has write permission for the directory in which the history ®le resides.
If any one of the above conditions does not occur, the history ®le will not be trimmed. When the history ®le is trimmed, the latest HISTSIZE commands will be available in the history ®le.
Special Commands
The following
1.Variable assignment lists preceding the command remain in effect when the command completes.
2.I/O redirections are processed after variable assignments.
3.Errors cause a script that contains them to abort.
4.Words following a command preceded by %% that are in the format of a variable assignment are expanded with the same rules as a variable assignment. This means that tilde substitution is per- formed after the = sign and word splitting and ®le name generation are not performed.
% : [ arg ... ] The command only expands parameters. A zero exit code is returned.
%. file [ arg ... ]
Read and execute commands from ®le and return. The commands are executed in the current shell environment. The search path speci®ed by PATH is used to ®nd the directory containing ®le. If any arguments arg are given, they become the positional parameters. Otherwise the positional parameters are unchanged. The exit status is the exit status of the last command executed. It is not necessary that the execute permission bit be set for ®le.
Section 1−406 | − 11 − |