Hacker News new | ask | show | jobs
by colonwqbang 1286 days ago
In bash/shell the expression $a is "just" a shorthand for ${a}, which is the more general syntax. Shell does not really make a distinction between string interpolation and ... well, everything else. It's a bit like how we don't always have to write out the curly braces of an if statement in C.

I'll also point out that in shell assignment looks like

  a="foo"
not

  $a="foo"
The dollar sign of shell feels to me more like an operator you use when you want to access the value of a variable. Not a part of the name of the variable as in PHP.