Up Next Previous

Special aliases (+)

If set, each of these aliases executes automatically at the indicated time. They are all initially undefined.

Runs when the shell wants to ring the terminal bell.

Runs after every change of working directory. For example, if the user is working on an X window system using xterm(1) and a re-parenting window manager that supports title bars such as twm(1) and does

> alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"'

then the shell will change the title of the running xterm(1) to be the name of the host, a colon, and the full current working directory. A fancier way to do that is

> alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'

This will put the hostname and working directory on the title bar but only the hostname in the icon manager menu.

Note that putting a cd, pushd or popd in cwdcmd may cause an infinite loop. It is the author's opinion that anyone doing so will get what they deserve.

Runs before each command gets executed, or when the command changes state. This is similar to postcmd, but it does not print builtins.

> alias jobcmd 'echo -n "^[]2\;\!#^G"'

then executing vi foo.c will put the command string in the xterm title bar.

Invoked by the run-help editor command. The command name for which help is sought is passed as sole argument. For example, if one does

> alias helpcommand '\!:1 --help'

then the help display of the command itself will be invoked, using the GNU help calling convention. Currently there is no easy way to account for various calling conventions (e.g., the customary Unix `-h'), except by using a table of many commands.

Runs every tperiod minutes. This provides a convenient means for checking on common but infrequent changes such as new mail. For example, if one does

> set tperiod = 30
> alias periodic checknews

then the checknews(1) program runs every 30 minutes. If periodic is set but tperiod is unset or set to 0, periodic behaves like precmd.

Runs just before each prompt is printed. For example, if one does

> alias precmd date

then date(1) runs just before the shell prompts for each command. There are no limits on what precmd can be set to do, but discretion should be used.

Runs before each command gets executed.

> alias postcmd 'echo -n "^[]2\;\!#^G"'

then executing vi foo.c will put the command string in the xterm title bar.

Specifies the interpreter for executable scripts which do not themselves specify an interpreter. The first word should be a full path name to the desired interpreter (e.g., `/bin/csh' or `/usr/local/bin/tcsh').

Up Next Previous