September 2018
Beginner
186 pages
4h 30m
English
The declare builtin sets or displays variables (including arrays) and functions. It's not usually needed for setting variables, but it's a good way to get an overview of your shell's current running state, providing more information than the set builtin.
Run with only the -p option, declare prints the values of all of the variables in the current shell environment, along with some short option flags that describe their properties:
bash$ declare -p declare -- BASH="/bin/bash" declare -r BASHOPTS="cdspell:checkhash:checkjobs:checkwinsize:... declare -ir BASHPID declare -A BASH_ALIASES=() declare -a BASH_ARGC=() ...
If you include the names of any variables after -p, without the dollar sign prefix, Bash will print results ...
Read now
Unlock full access