bash-hackers-wiki/docs/commands/builtin/shopt.md
Hanson Char b75c3a588b Fix hyperlinks of markdown pages at depth 3
find docs/ -depth 3  -name '*.md' | xargs grep '(.*/' -l | \
  xargs -I{} \
  sed -i '' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)\(.md\)\{0\})%(../../\1/\2.md)%g' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)#\([a-zA-Z_-][0-9a-zA-Z_-]*\))%(../../\1/\2.md#\3)%g' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)\(.md\)\{0\})%(../../\1/\2/\3.md)%g' \
  -e 's%(/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)/\([^/#).][^/#).]*\)#\([a-zA-Z_-][0-9a-zA-Z_-]*\))%(../../\1/\2/\3.md#\4)%g' \
  -e 's%](\([^:.>)#][^:.>)#]*\))%](../../\1.md)%g' \
  -e 's%](\([^:.>)#][^:.>)#]*\)#\([^:.>)#][^:.>)#]*\))%](../../\1.md#\2)%g' \
  {}

Related to https://github.com/flokoe/bash-hackers-wiki/issues/10
2024-01-28 17:26:57 -08:00

52 lines
1.8 KiB
Markdown

# The shopt builtin command
The `shopt` builtin manages [shell options](../../internals/shell_options.md), a
set of boolean (`on`/`off`) configuration variables that control the
behaviour of the shell.
## Synopsis
shopt [-pqsu] [-o] <OPTNAME...>
## Description
Note: Some of these options and other shell options can also be set with
[the set builtin](../../commands/builtin/set.md).
### Options
Option Description
-------- -----------------------------------------------------------------------------------------------------------------------------
`-o` Restrict the values of `<OPTNAME...>` to only those also known by [the set builtin](../../commands/builtin/set.md)
`-p` Print all shell options and their current value. **Default**.
`-q` Quiet mode. Set exit code if named option is set. For multiple options: `TRUE` if all options are set, `FALSE` otherwise
`-s` Enable ([s]{.underline}et) the shell options named by `<OPTNAME...>` or list all *enabled* options if no names are given
`-u` Disabe ([u]{.underline}nset) the shell options named by `<OPTNAME...>` or list all *disabled* options if no names are given
As noted above, if only `-s` or `-u` are given without any option names,
only the currently enabled (`-s`) or disabled (`-u`) options are
printed.
### Exit code
When listing options, the exit code is `TRUE` (0), if all options are
enabled, `FALSE` otherwise.
When setting/unsetting an option, the exit code is `TRUE` unless the
named option doesn\'t exitst.
## Examples
Enable the `nullglob` option:
shopt -s nullglob
## Portability considerations
The `shopt` command is not portable accross different shells.
## See also
- Internal: [The set builtin command](../../commands/builtin/set.md)
- Internal: [List of shell options](../../internals/shell_options.md)