← All tips

Bash: default a variable

bashbasics

Use parameter expansion to set defaults.

PORT=${PORT:-4321}
echo "$PORT"