B.6. set Options

 < Day Day Up > 

Table B-7 lists the options that can be turned on with the set -arg command. All are initially off except where noted. Full Names, where listed, are arguments to set that can be used with set -o. The Full Names braceexpand, histexpand, history, keyword, and onecmd are not available in versions of bash prior to 2.0. Also, in those versions, hashing is switched with -d.

Table B-7. Options to set

Option

Full name

Meaning

-a

allexport

Export all subsequently defined or modified variables.

-B

braceexpand

The shell performs brace expansion. This is on by default.

-b

notify

Report the status of terminating background jobs immediately.

-C

noclobber

Don't allow redirection to overwrite existing files.

-E

errtrace

Any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment.

-e

errexit

Exit the shell when a simple command exits with non-zero status. A simple command is a command not part of a while, until, or if; or part of a && or || list; or a command whose return value is inverted by !.

 

emacs

Use emacs-style command-line editing.

-f

noglob

Disable pathname expansion.

-H

histexpand

Enable ! style history substitution. On by default in an interactive shell.

 

history

Enable command history. On by default in interactive shells.

-h

hashall

Disable the hashing of commands.

 

ignoreeof

Disallow CTRL-D to exit the shell.

-k

keyword

Place keyword arguments in the environment for a command.

-m

monitor

Enable job control (on by default in interactive shells).

-n

noexec

Read commands and check syntax but do not execute them. Ignored for interactive shells.

-P

physical

Do not follow symbolic links on commands that change the current directory. Use the physical directory.

-p

privileged

Script is running in suid mode.

 

pipefail

The return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.

 

posix

Change the default behavior to that of POSIX 1003.2 where it differs from the standard.

-T

functrace

Any trap on DEBUG is inherited by shell functions, command substitutions, and commands executed in a subshell environment.

-t

onecmd

Exit after reading and executing one command.

-u

nounset

Treat undefined variables as errors, not as null.

-v

verbose

Print shell input lines before running them.

 

vi

Use vi-style command-line editing.

-x

xtrace

Print commands (after expansions) before running them.

-

 

Signals the end of options. All remaining arguments are assigned to the positional parameters. -x and -v are turned off. If there are no remaining arguments to set, the positional arguments remain unchanged.

 

With no arguments following, unset the positional parameters. Otherwise, the positional parameters are set to the following arguments (even if they begin with -).


     < Day Day Up > 


    Learning the bash Shell
    Learning the bash Shell: Unix Shell Programming (In a Nutshell (OReilly))
    ISBN: 0596009658
    EAN: 2147483647
    Year: 2005
    Pages: 139

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net