In shell scripts, when do we use {} when expanding variables?
{}
For example, I have seen the following:
var=10 # Declare variable
You use {} for grouping. The braces are required to dereference array elements. Example:
dir=(*) # store the contents of the directory into an array echo "${dir[0]}" # get the first entry. echo "$dir[0]" # incorrect