Table of Contents
Bash Reserved Words
Also called: Bash Keywords, Bash Language Keywords, Bash Reserved Words, Bash Reserved Keywords, Bash Reserved Identifiers
Return to Reserved keywords, Reserved words, Reserved identifier, Keywords, Bash, Bash DevOps - Bash SRE - Bash CI/CD, Cloud Native Bash - Bash Microservices - Serverless Bash, Bash Security - Bash DevSecOps, Functional Bash, Bash Concurrency, Bash Data Science - Bash and Databases, Bash Machine Learning, Bash Bibliography, Bash Courses, Bash Glossary, Awesome Bash, Bash GitHub, Bash Topics
Like any programming language, the Bash language designates certain words that the Bash interpreter (the specific Linux shell or Unix shell) recognizes as special words. For that reason, you're not allowed to use them for Bash naming | naming your Bash constructs. The list of Bash reserved words (also called Bash keywords) is surprisingly short:
Reserved words are words that have special meaning to the shell. They are used to begin and end the shell’s compound commands.
Creating a glossary of Bash reserved words sorted by their frequency of use is somewhat subjective, as it depends on what kinds of scripts are being written. Common scripting tasks often involve iteration, conditionals, and defining functions, which will guide our list of commonly used reserved words. Here's an attempt to outline these, formatted in MediaWiki markup:
```mediawiki
Bash Reserved Words Glossary
This glossary lists Bash reserved words that are frequently used in shell scripting. Each entry includes a brief code example to illustrate its usage.
if
The `if` statement is used to execute commands based on a condition.
if [ "$a" -eq "$b" ]; then echo "a equals b" fi
else
The `else` statement is used to execute commands if the `if` condition is false.
if [ "$a" -eq "$b" ]; then echo "a equals b" else echo "a does not equal b" fi
elif
The `elif` (else if) statement allows for multiple conditions.
if [ "$a" -eq "$b" ]; then echo "a equals b" elif [ "$a" -gt "$b" ]; then echo "a is greater than b" else echo "a is less than b" fi
for
The `for` loop is used to iterate over a series of values.
for i in 1 2 3; do echo "$i" done
while
The `while` loop executes as long as a condition is true.
while [ "$a" -lt 10 ]; do echo "$a" a=$((a + 1)) done
do
The `do` keyword is used with loops (`for`, `while`, `until`) to start the execution block.
for i in 1 2 3; do echo "$i" done
done
The `done` keyword is used to end a loop (`for`, `while`, `until`).
while [ "$a" -lt 10 ]; do echo "$a" a=$((a + 1)) done
function
The `function` keyword is used to define a function.
function my_func() { echo "Hello World" }
case
The `case` statement allows branching based on patterns.
case "$1" in start) echo "Starting" ;; stop) echo "Stopping" ;; *) echo "Usage: $0 start]] | [[stop" ;; esac
esac
The `esac` keyword is used to end a `case` statement.
case "$1" in start]] | [[stop) echo "Will start or stop" ;; *) echo "Unknown command" ;; esac
in
The `in` keyword is used with `case` and `for` statements to specify a list.
for i in $(seq 1 3); do echo "$i" done
until
The `until` loop is used to execute commands until a condition is true.
until [ "$a" -ge 10 ]; do echo "$a" a=$((a + 1)) done
select
The `select` statement is used to generate a menu from a list of items.
select choice in "Option 1" "Option 2" "Option 3"; do case $REPLY in 1) echo "Selected Option 1"; break ;; 2) echo "Selected Option 2"; break ;; 3) echo "Selected Option 3"; break ;; *) echo "Invalid selection"; break ;; esac done
This list includes some of the most commonly used Bash reserved words, ideal for beginners and those looking to understand shell scripting better. Bash scripting allows for complex flow control, function definitions, and system automation with these and other reserved words. ```
This format is designed for easy inclusion in a MediaWiki-based site, offering clear examples and explanations to help readers quickly understand the use of each reserved word in Bash scripting.
The following words are recognized as reserved when unquoted and the first word of a command (see below for exceptions):
{ } bash_reserved_words !
in is recognized as a reserved word if it is the third word of a case or select command. in and do are recognized as reserved words if they are the third word in a for command.
https://www.gnu.org/software/bash/manual/html_node/Reserved-Words.html
Research More
Fair Use Sources
Bash Vocabulary List (Sorted by Popularity)
Bash Programming Language, Bash Shell, Bash Scripting, Bash Command Line, Bash Command, Bash Variable, Bash Environment Variable, Bash PATH Variable, Bash cd Command, Bash ls Command, Bash echo Command, Bash if Statement, Bash for Loop, Bash while Loop, Bash until Loop, Bash case Statement, Bash function Definition, Bash array Variable, Bash associative Array, Bash declare Command, Bash typeset Command, Bash local Variable, Bash global Variable, Bash positional Parameters, Bash $0 Variable, Bash $1 Variable, Variable, Bash $* Variable, Bash $@ Variable, Bash $, Bash $$ Variable, Bash $! Variable, Bash $- Variable, Bash IFS Variable, Bash PS1 Prompt, Bash PS2 Prompt, Bash PS4 Prompt, Bash HOME Variable, Bash USER Variable, Bash HOSTNAME Variable, Bash OSTYPE Variable, Bash SHELL Variable, Bash TERM Variable, Bash exit Command, Bash return Command, Bash break Command, Bash continue Command, Bash read Command, Bash printf Command, Bash test Command, Bash [ Command, Bash [[ Command], Bash builtin Command, Bash type Command, Bash command Command, Bash hash Command, Bash alias Command, Bash unalias Command, Bash set Command, Bash shopt Command, Bash export Command, Bash unset Command, Bash readonly Command, Bash trap Command, Bash wait Command, Bash kill Command, Bash jobs Command, Bash fg Command, Bash bg Command, Bash disown Command, Bash exec Command, Bash time Command, Bash times Builtin, Bash source Command, Bash . Command (Dot Command), Bash eval Command, Bash complete Command, Bash compgen Command, Bash compopt Command, Bash history Command, Bash fc Command, Bash pushd Command, Bash popd Command, Bash dirs Command, Bash pwd Command, Bash oldpwd Variable, Bash command Substitution, Bash $( ) Syntax, Bash Backticks `...`, Bash Variable Substitution, Bash Parameter Expansion, Bash ${var} Syntax, -default}, =default}, Bash ${var, +replacement}, var}, Bash ${var%pattern}, Bash ${var%%pattern}, pattern}, #pattern}, length}, Bash Arithmetic Expansion, Bash $(( expression )) Syntax, Bash (( ... )) Arithmetic, Bash Globbing, Bash Filename Expansion, Bash Wildcard *, Bash Wildcard , Bash Character Class [...], Bash Brace Expansion, Bash {1..10} Expansion, Bash {a,b,c} Expansion, Bash Tilde Expansion, Bash ~ User Home Expansion, Bash ~+ Expansion ($PWD), Bash ~- Expansion ($OLDPWD), Bash aliasing Commands, Bash .bashrc File, Bash .bash_profile File, Bash .profile File, Bash .bash_login File, Bash .bash_history File, Bash /etc/bashrc File, Bash /etc/profile File, Bash elif Keyword, Bash else Keyword, Bash fi Keyword, Bash Arithmetic Conditions (( )), Bash String Comparisons, Bash Integer Comparisons (-eq, -ne, -gt, -lt), Bash File Conditions (-f, -d, -e, -r, -w, -x), | !, Bash Pipeline Operator, Bash pipefail Option, Bash Redirection >, Bash Redirection >>, Bash Redirection <, Bash Redirection << (Here-Doc), Bash Redirection <<< (Here-String), Bash Redirection &>, Bash Redirection 2>, Bash Redirection &>>, Bash Redirection 2>>, Bash Redirection >, Bash noclobber Option, Bash Built-in Commands, Bash test Builtin, Bash Arithmetic Command (( )), Bash compgen Builtin, Bash environment Files, Bash read -p Prompt, Bash read -r Raw Input, Bash mapfile Command, Bash mapfile -t Option, Bash shopt -s histappend, Bash shopt -s cdspell, Bash shopt -s checkwinsize, Bash shopt -s cmdhist, Bash shopt -s dotglob, Bash shopt -s extglob, Bash shopt -s extdebug, Bash shopt -s globstar, Bash shopt -s histreedit, Bash shopt -s histverify, Bash shopt -s hostcomplete, Bash shopt -s interactive_comments, Bash shopt -s login_shell, Bash shopt -s mailwarn, Bash shopt -s nocaseglob, Bash shopt -s nocasematch, Bash shopt -s nullglob, Bash shopt -s progcomp, Bash shopt -s promptvars, Bash shopt -s sourcepath, Bash shopt -s xpg_echo, Bash BASH_VERSION Variable, Bash BASH_VERSINFO Array, Bash BASHOPTS Variable, Bash BASH_ALIASES Array, Bash BASH_ARGC Array, Bash BASH_ARGV Array, Bash BASH_CMDS Array, Bash BASH_LINENO Array, Bash BASH_SOURCE Array, Bash BASH_SUBSHELL Variable, Bash BASH_XTRACEFD Variable, Bash BASH_REMATCH Array, Bash COMP_CWORD Variable, Bash COMP_LINE Variable, Bash COMP_POINT Variable, Bash COMP_WORDS Array, Bash COMP_KEY Variable, Bash COMP_TYPE Variable, Bash COMP_REPLY Array, Bash COLUMNS Variable, Bash EUID Variable, Bash GROUPS Array, Bash HISTCMD Variable, Bash HOSTTYPE Variable, Bash LINENO Variable, Bash MACHTYPE Variable, Bash OPTARG Variable, Bash OPTIND Variable, Bash PPID Variable, Bash PWD Variable, Bash RANDOM Variable, Bash SECONDS Variable, Bash SHELLOPTS Variable, Bash SHLVL Variable, Bash UID Variable, Bash set -e Option, Bash set -u Option, Bash set -x Option, Bash set -o pipefail, Bash set -o nounset, Bash set -o errexit, Bash set -o xtrace, Bash set -o noglob, Bash set -o ignoreeof, Bash set -o vi, Bash set -o emacs, Bash PROMPT_COMMAND Variable, Bash PROMPT_DIRTRIM Variable, Bash completion (Tab Completion), Bash arithmetic $(( )) again for clarity, Bash (( ... )) Double Paren, Bash coproc Command, Bash co-processes, Bash read -s Silent Input, Bash read -n N Characters, Bash exec Redirection, Bash exec >file, Bash exec <file, Bash exec 3>file, Bash exec 3<file, Bash exec 3<>file, Bash test -f Check, Bash test -d Check, Bash test -r Check, Bash test -w Check, Bash test -x Check, Bash test -s Check, Bash test -z Empty String Check, Bash test -n Non-empty String, Bash test -eq Integer Equal, Bash test -ne Integer Not Equal, Bash test -gt Greater Than, Bash test -lt Less Than, Bash test -ge Greater Equal, Bash test -le Less Equal, Bash declare -i Integer Variable, Bash declare -r Read-only, Bash declare -x Export Variable, Bash printf Formatting, Bash shift Command, (Colon) No-Op, Bash true Command Builtin, Bash false Command Builtin, Bash export -f Function Export, Bash read -a Read into Array, Bash read -d Delimiter, Bash read -t Timeout, Bash compgen -A function, Bash compgen -A alias, Bash compgen -A builtin, Bash compgen -A command, Bash compgen -A file, Bash ulimit Command, Bash dirs stack Command, Bash fc -s Redo Command, Bash globstar ** Pattern, Bash extglob @(), !(), *(), +(), , Bash suspend Command, Bash jobs -l Option, Bash jobs -p Option, Bash kill -l List Signals, Bash kill -s Send Signal By Name, Bash disown -r Option, Bash fc -e Editor Mode, Bash readarray Command, Bash cd -P Option, Bash cd -L Option, Bash set +o Disable Option, Bash BASH_ENV Variable, Bash shopt -s cdable_vars, Bash shopt -s autocd, Bash shopt -s dirspell, Bash globstar ** repeated concept for emphasis, Bash SIGINT Trap, Bash SIGTERM Trap, Bash cd oldpwd with cd - used conceptually, Bash read -s for password input, Bash read -n for limited chars, Bash exec 3>&1 duplicate fd, Bash exec 2>&1 redirect stderr to stdout, Bash command substitution in $( ) repeated concept, Bash arrays indexing ${array[0]}, array[@]}, Bash associative arrays declare -A, Bash indexing associative arrays ${assoc[key]}, Bash advanced completion with complete command, Bash bind Keybindings, Bash bind -P Show Keybindings, Bash bind -S Show Settable Options, Bash bind -X Show Keyseq Functions, Bash line editing vi mode repeated concept, Bash line editing emacs mode repeated concept, Bash fc -l List history range, Bash fc -r Reverse order history listing, Bash dirs +N Switch Stacks, Bash dirs -N Switch Stacks, Bash dirs -p Print One per Line, Bash dirs -l Long Listing, Bash kill -9 Hard Kill, Bash kill -INT Interrupt, Bash kill -TERM Terminate
Bash: bashrc, Bash Fundamentals, Bash Inventor - Bash Language Designer: Brian Fox on June 8, 1989 at urging of Richard Stallman of Free Software Foundation (FSF); Chet Ramey is now the maintainer. Bash Scripting, Bash DevOps - Bash SRE, Cloud Native Bash (Bash on Kubernetes - Bash on AWS - Bash on Azure - Bash on GCP), Bash Microservices, Bash Containerization (Bash Docker - Bash on Docker Hub), Serverless Bash, Bash Data Science - Bash DataOps - Bash and Databases (Bash ORM), Bash ML - Bash DL, Functional Bash (1. Bash Immutability, 2. Bash Purity - Bash No Side-Effects, 3. Bash First-Class Functions - Bash Higher-Order Functions, Bash Lambdas - Bash Anonymous Functions - Bash Closures, Bash Lazy Evaluation, 4. Bash Recursion), Reactive Bash), Bash Concurrency - Bash Parallel Programming - Async Bash, Bash Networking, Bash Security - Bash DevSecOps - Bash OAuth, Bash Memory Allocation (Bash Heap - Bash Stack - Bash Garbage Collection), Bash CI/CD - Bash Dependency Management - Bash DI - Bash IoC - Bash Build Pipeline, Bash Automation - Bash Scripting, Bash Package Managers, Bash Modules - Bash Packages, Bash Installation (Bash Windows - Chocolatey Bash, Bash macOS - Homebrew Bash, Bash on Linux), Bash Configuration, Bash Observability (Bash Monitoring, Bash Performance - Bash Logging), Bash Language Spec - Bash RFCs - Bash Roadmap, Bash Keywords, Bash Operators, Bash Functions, Bash Data Structures - Bash Algorithms, Bash Syntax, Bash OOP (1. Bash Encapsulation - 2. Bash Inheritance - 3. Bash Polymorphism - 4. Bash Abstraction), Bash Design Patterns - Bash Best Practices - Bash Style Guide - Clean Bash - Bash BDD, Bash Generics, Bash I/O, Bash Serialization - Bash Deserialization, Bash APIs, Bash REST - Bash JSON - Bash GraphQL, Bash gRPC, Bash Virtualization, Bash Development Tools: Bash SDK, Bash Compiler - Bash Transpiler, Bash Interpreter - Bash REPL, Bash IDEs (JetBrains Bash, Bash Visual Studio Code), Bash Linter, Bash Community - Bashaceans - Bash User, Bash Standard Library - Bash Libraries - Bash Frameworks, Bash Testing - Bash TDD, Bash History, Bash Research, Bash Topics, Bash Uses - List of Bash Software - Written in Bash - Bash Popularity, Bash Bibliography - Bash Courses, Bash Glossary - Bash Official Glossary, Bash GitHub, Awesome Bash. (navbar_bash)
Cloud Monk is Retired ( for now). Buddha with you. © 2025 and Beginningless Time - Present Moment - Three Times: The Buddhas or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.