ksh.1 (2010 09)

k
ksh(1) ksh(1)
The special command fc is used to list or edit a portion of this file. The portion of the file to be edited or
listed can be selected by number or by giving the first character or characters of the command. A single
command or range of commands can be specified. If no editor program is specified as an argument to
fc,
the value of the
FCEDIT parameter is used. If
FCEDIT is not defined, /usr/bin/ed is used. The
edited command is printed and re-executed upon leaving the editor. The editor name
- is used to skip
the editing phase and to re-execute the command. In this case a substitution parameter of the form
old
=new can be used to modify the command before execution.
For example, if
r is aliased to
fc -e -, typing r bad=good c re-executes the most recent command
that starts with the letter
c and replaces the first occurrence of the string
bad with the string good.
The history file 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 file has not been modified in the last ten minutes.
The user has write permission for the directory in which the history file resides.
If any one of the above conditions does not occur, the history file will not be trimmed. When the history
file is trimmed, the latest
HISTSIZE commands will be available in the history file.
Special Commands
The following simple-commands are executed in the shell process. They permit input/output redirection.
Unless otherwise indicated, file descriptor 1 is the default output location and the exit status, when there
are no syntax errors, is zero. Commands that are preceded by
% or %% are treated specially in the fol-
lowing ways:
1. Variable assignment lists preceding the command remain in effect when the command com-
pletes.
2. I/O redirections are processed after variable assignments.
3. Certain 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 performed after the
= sign and word splitting and file name generation are not performed.
The special commands are list here:
%:[ arg ... ] The command only expands parameters. A zero exit code is returned.
%.file [ arg ... ]
Read and execute commands from file and return. The commands are executed in the
current shell environment. The search path specified by PATH is used to find the direc-
tory containing file. If any arguments arg are given, they become the positional parame-
ters. 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 file .
%% alias [ -tx][name[=value ] ... ]
alias with no arguments prints the list of aliases in the form name=value on standard
output. An alias is defined for each name whose value is given. A trailing space in value
causes the next word to be checked for alias substitution. The -t option is used to set
and list tracked aliases. The value of a tracked alias is the full path name corresponding
to the given name. The value of a tracked alias becomes undefined when the value of
PATH is reset, but the alias remains tracked. Without the -t option, for each name in
the argument list for which no value is given, the name and value of the alias is printed.
The -x option is used to set or print exported aliases. An exported alias is defined
across sub-shell environments. Alias returns true unless a name is given for which no
alias has been defined.
bg [ job ... ] Puts the specified jobs into the background. The current job is put in the background if
job is unspecified. See Jobs for a description of the format of job.
% break [ n ] Exit from the enclosing for, while, until,or select loop, if any. If n is specified,
break n levels.
% continue [ n ]
Resume the next iteration of the enclosing for, while, until,or select loop. If n is
12 Hewlett-Packard Company 12 HP-UX 11i Version 3: September 2010