shopt
Shopt is a builtin command in the Bash shell that controls the behavior of the shell by enabling or disabling certain boolean options. These options affect features such as filename expansion (globbing), pattern matching, and how history and input are handled. Shopt options are specific to Bash and may not exist in other shells.
Usage and basic behavior: shopt [-pqsu] [optname ...]. If optname is omitted, shopt shows the status of
Commonly used options include:
- extglob: enables extended pattern matching for complex glob patterns.
- nullglob: patterns that do not match expand to nothing instead of themselves.
- failglob: patterns that do not match cause an error.
- dotglob: include files beginning with a dot in glob results.
- globstar: enables recursive globbing with **.
- nocasematch: makes pattern matching case-insensitive.
- autocd: allows changing directories by typing a directory name alone.
- cdspell: corrects minor typos in directory names during cd.
- histappend: appends history lines to the history file instead of overwriting it.
- checkwinsize: updates the shell’s idea of window size after each command.
- if shopt -q nocasematch; then echo on; fi
Notes: The set of available options varies with Bash version, and some options may be unsupported