Overview - Variable assignment (no spaces around =)
What is it?
Variable assignment in bash scripting means giving a name to a value so you can use it later. In bash, you write the variable name, then an equal sign '=', then the value, all without spaces. This rule is important because spaces change how the shell reads your command. Variables help store information like text or numbers during a script's run.
Why it matters
Without the rule of no spaces around '=', bash would confuse variable assignment with commands or arguments, causing errors. This rule makes scripts predictable and easy to read for the shell. If you ignore it, your script might fail or behave unexpectedly, which can waste time and cause frustration.
Where it fits
Before learning variable assignment, you should know basic bash commands and how the shell reads input. After mastering assignment, you can learn how to use variables in commands, perform arithmetic, and write conditional scripts.