echo ${VAR:-default}

Category: Shell & Bash

echo ${VAR:-default}

Use default value if VAR is unset or empty

Expands VAR if it has a value, or uses 'default' if VAR is unset or empty. A safe way to provide fallback values.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.