EXEC(1CSH) COMMAND REFERENCE EXEC(1CSH) NAME exec - execute command in place of the current shell (csh built-in) SYNOPSIS exec command [ arg... ] DESCRIPTION The exec command executes the given command in place of the current shell. Since there are a limited number of processes available for each user, it is useful to be able to execute the last command in place of the shell so that the process isn't hanging around with nothing to do. The command may not be a csh built-in. EXAMPLES This example shows an interface to the command make(1), which can be used by someone with a lot of commands and directories to keep up with. The environment variable MAKEDB contains the name of a file which contains entries of the form: name<TAB>directory<TAB>description where the name is the name given to the script, the directory is the pathname of the directory where make should be run, and description is a message to be printed before executing the make command. #!/bin/csh -f set Myname=`basename $0` # # Check usage. # if ($#argv != 1) then echo "$Myname : usage : $Myname target" exit 1 endif # # This awk script looks through the database for the entry. # eval `awk -Ft '{ if ($1 == name) { printf "set Dir=%s ; echo %s", $2, $3; exit; } }' name="$1" "$MAKEDB" ` # # Change to the named directory and run the command. # cd "$Dir" exec make "$1" Note: the awk(1) script must be given on a single line. It is split here for readability. Printed 5/12/88 1
EXEC(1CSH) COMMAND REFERENCE EXEC(1CSH) Another use of exec is to exit the login shell without executing commands from the .logout file. For example, executing the command ``exec clear'' in the login shell will clear the screen and log the user out. VARIABLES PATH The user's execution search path. RETURN VALUE The return value is the return value of the command executed, or 1 if the command does not exist. CAVEATS The exec command never returns, even if the command was not found. SEE ALSO @(1csh), alias(1csh), bg(1csh), break(1csh), cd(1csh), chdir(1csh), continue(1csh), csh(1csh), dirs(1csh), echo(1csh), eval(1csh), exec(1sh), exit(1csh), fg(1csh), glob(1csh), goto(1csh), hashstat(1csh), history(1csh), jobs(1csh), kill(1csh), limit(1csh), logout(1csh), nice(1csh), nohup(1csh), notify(1csh), onintr(1csh), popd(1csh), pushd(1csh), rehash(1csh), repeat(1csh), set(1csh), setenv(1csh), sh(1sh), shift(1csh), source(1csh), stop(1csh), suspend(1csh), time(1csh), umask(1csh), unhash(1csh), unalias(1csh), unlimit(1csh), unset(1csh), unsetenv(1csh), wait(1csh), which(1csh), execve(2), and fork(2). Printed 5/12/88 2
%%index%% na:312,154; sy:466,179; de:645,559; ex:1204,1453;3041,284; va:3325,155; rv:3480,232; ca:3712,196; se:3908,1603; %%index%%000000000145