-->

Previous | Table of Contents | Next

Page 40

If the popd command is successful, a dirs is performed as well, and the return status is 0. popd returns False if an illegal option is encountered, the directory stack is empty, a nonexistent directory stack entry is specified, or the directory change fails.
pushd [dir] pushd +/_n Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, exchanges the top two directories and returns 0, unless the directory stack is empty.
+n Rotates the stack so that the nth directory (counting from the left of the list shown by dirs) is at the top.
_n Rotates the stack so that the nth directory (counting from the right) is at the top.
dir Adds dir to the directory stack at the top, making it the new current working directory.
If the pushd command is successful, a dirs is performed as well. If the first form is used, pushd returns 0 unless the cd to dir fails. With the second form, pushd returns 0 unless the directory stack is empty, a nonexistent directory stack element is specified, or the directory change to the specified new current directory fails.
pwd Print the absolute pathname of the current working directory. The path printed contains no symbolic links if the _P option to the set builtin command is set. (See also the description of nolinks under "Shell Variables," earlier in this manual page.) The return status is 0 unless an error occurs while reading the pathname of the current directory.
read [_r][name ...] One line is read from the standard input, and the first word is assigned to the first name, the second word to the second name, and so on, with leftover words assigned to the last name. Only the characters in IFS are recognized as word delimiters. If no names are supplied, the line read is assigned to the variable REPLY. The return code is zero, unless end-of-file is encountered. If the -r option is given, a backslash-newline pair is not ignored, and the backslash is considered to be part of the line.
readonly [_f][name ...] The given names are marked readonly and the values of these names may not be
readonly -p changed by subsequent assignment. If the _f option is supplied, the functions corresponding to the names are so marked. If no arguments are given, or if the
_p option is supplied, a list of all readonly names is printed. An argument of — disables option checking for the rest of the arguments. The return status is 0 unless an illegal option is encountered, one of the names is not a legal shell variable name, or _f is supplied with a name that is not a function.
return [n] Causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command executed in the function body. If used outside a function, but during execution of a script by the . (source) command, it causes the shell to stop executing that script and return either n or the exit status of the last command executed within the script as the exit status of the script. If used outside a function and not during execution of a script by (. , the return status is False.
set [—abefhkmnptuvxldCHP]
[-o option][arg ...]
_a Automatically mark variables that are modified or created for export to the environment of subsequent commands.
_b Cause the status of terminated background jobs to be reported immediately, rather than before the next primary prompt. (Also see notify under "Shell Variables.")
_e Exit immediately if a simple command (see "Shell Grammar," earlier in this manual page) exits with a non_zero status. The shell does not exit if the command that fails is part of an until

Page 41

or while loop, part of an if statement, part of a && or || list, or if the command's return value is being inverted via!.
_f Disable pathname expansion.
_h Locate and remember function commands as functions are defined. Function commands are normally looked up when the function is executed.
_k All keyword arguments are placed in the environment for a command, not just those that precede the command name.
_m Monitor mode. Job control is enabled. This flag is on by default for interactive shells on systems that support it. (See "Job Control," earlier in this manual page.) Background processes run in a separate process group and a line containing their exit status is printed upon their completion.
_n Read commands but do not execute them. This may be used to check a shell script for syntax errors. This is ignored for interactive shells.
_o option-name The option-name can be one of the following:
allexport—Same as _a.
braceexpand—The shell performs brace expansion. (See "Brace Expansion," earlier in this manual page.) This is on by default.
emacs—Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with the _nolineediting option.
errexit—Same as _e.
histexpand—Same as _H.
ignoreeof—The effect is as if the shell command `IGNOREEOF=10' had been executed. (See "Shell Variables.")
interactive_comments—Allow a word beginning with # to cause that word and all remaining characters on that line to be ignored in an interactive shell. (See "Comments," earlier in this manual page.)
monitor—Same as _m.
noclobber—Same as _C.
noexec—Same as _n.
noglob—Same as _f.
nohash—Same as _d.
notify—Same as _b.
nounset—Same as _u.
physical—Same as _P.
posix—Change the behavior of bash where the default operation differs from the POSIX 1003.2 standard to match the standard.
privileged—Same as _p.
verbose—Same as _v.
vi—Use a vi-style command line editing interface.
xtrace—Same as _x.
If no option-name is supplied, the values of the current options are printed.

Previous | Table of Contents | Next