Overview - Accessing variables ($var and ${var})
What is it?
In bash scripting, variables store values like words or numbers. To use these stored values, you write the variable name with a dollar sign in front, like $var. Sometimes, you use curly braces around the variable name, like ${var}, to clearly mark where the variable name ends. This helps the shell understand exactly what you want to use.
Why it matters
Without a clear way to access variables, scripts would be confusing and error-prone. Imagine trying to mix words and variables without knowing where one ends and the other begins. Using $var and ${var} makes scripts readable and reliable, so your commands do exactly what you expect.
Where it fits
Before learning this, you should know what variables are and how to create them in bash. After mastering variable access, you can learn about variable manipulation, like changing values or using default values, and then move on to more complex scripting concepts like loops and conditionals.