I know that ${var}
and $var
does the same thing. I also know that you can use brace for advanced options like ${var:=word}
or ${var#pattern}
. It's also explained here.
But I see in some bash scripts the use of braces in the simplest form : ${var}
and sometimes I see only this notation $var
.
Is there any reason to prefer this syntax over the simple $var
as it does the same thing ? Is it for portability ? Is it a coding style ?
As a conscientious developer, which syntax I should use ?