set Options

The options in set Options can be turned on with the set -arg command. They are all 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 A-6. set options

Option

Full name (-o)

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 nonzero status. A simple command is a command not part of a while, until, or if; nor part of a && or || list; nor 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

Enable the hashing of commands.

ignoreeof

Disallow Ctrl-D to exit the shell.

-k

keyword

All arguments in the form of assignment statements are placed in the environment for ...

Get bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.