Variables & Quoting
SH · Bash Scriptingsyntax
name=value
$name or ${name}
"double quotes" vs 'single quotes'example
APP_ENV="production"
PORT=8080
echo "Server running on port ${PORT} in ${APP_ENV}"
FILES=$(ls *.conf)
READONLY_VAR="locked"
readonly READONLY_VARoutput
Server running on port 8080 in productionNote No spaces around the = sign. Double quotes expand variables; single quotes are literal. Always double-quote variable expansions ("$var") to prevent word splitting and glob expansion. Use $() for command substitution instead of backticks.