Expand parameter with a fallback.
Section: Variables and Expansion
Use default value if unset
bash
bash
echo "${PORT:-8080}"Explanation
Useful in scripts where environment variables may be optional.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Variables and Expansion