Feb 25 2008
∞
BASH: When Spaces Matter
As I primarily work with PHP, I have no problem (mostly), dropping in spaces haphazardly. In fact, my convetion for var setting looks like
$variable= “value”;
note the space between $variable and “value”.
Well, when you’re scripting for BASH, the space results in “value” being treated as a shell command. This is almost certainly not what you want.
I’m probably not going to switch to $variable=”value”; across the board, because I think my style is much more readable, but it’s always nice to know that shell scripting is a little stricter.