Table 8.8. The set Command Options
Option | Meaning |
---|
–a | Marks variables that have been modified or exported |
–e | Exits the program if a command returns a nonzero status |
–f | Disables globbing (filename expansion) |
–h | Locates and remembers function commands as functions when they are defined, not just when they are executed |
–k | Places all keyword arguments in the environment for a command, not just those that precede the command name |
–n | Reads commands but does not execute them; used for debugging |
–t | Exits after reading and executing one command |
–u | Treats unset variables as an error when performing substitution |
–v | Prints shell input lines as they are read; used for debugging |
–x | Prints commands and their arguments as they are being executed; used for debugging |
–– | Does not change any of the flags |
The shell has a number of commands that are built into its source code. Because the commands are built-in, the shell doesn't have to locate them on disk, making execution much faster. The built-in commands are listed in Table 8.9.
Table 8.9. Built-In Commands
Command | What It Does |
---|
: | Do-nothing command; returns exit status 0 |
. file | The dot command reads and executes command from file |
break [n] | See "The break Command" on page 361 |
cd | Change directory |
continue [n] | See "The continue Command" on page 362 |
echo [ args ] | Echo arguments |
eval command | Shell scans the command line twice before execution |
exec command | Runs command in place of this shell |
exit [ n ] | Exit the shell with status n |
export [ var ] | Make var known to subshells |
hash | Controls the internal hash table for quicker searches for commands |
kill [ –signal process ] | Sends the signal to the PID number or job number of the process; see /usr/include/sys/signal.h for a list of signals |
getopts | Used in shell scripts to parse command line and check for legal options |
login [ username ] | Sign onto the system |
newgrp [ arg ] | Logs a user into a new group by changing the real group and effective group ID |
pwd | Print present working directory |
read [ var ] | Read line from standard input into variable var |
readonly [ var ] | Make variable var read-only; cannot be reset |
return [ n ] | Return from a function where n is the exit value given to the return |
set | See Table 8.8 |
shift [ n ] | Shift positional parameters to the left n times |
stop pid | Halt execution of the process number PID |
suspend | Stops execution of the current shell (but not if a login shell) |
times | Print accumulated user and system times for processes run from this shell |
trap [ arg ] [ n ] | When shell receives signal n ( 0, 1, 2, or 15 ), execute arg |
type [ command ] | Prints the type of command; for example, pwd has a built-in shell, in ksh, an alias for the command whence –v |
umask [ octal digits ] | User file creation mode mask for owner, group, and others |
unset [ name ] | Unset value of variable or function |
wait [ pid#n ] | Wait for background process with PID number n and report termination status |
ulimit [ options size ] | Set maximum limits on processes |
umask [ mask ] | Without argument, print out file creation mask for permissions |
wait [ pid#n ] | Wait for background process with PID number n and report termination status |