AnyCompiler

Variables

Assigning a variable looks like name=value, with no spaces at all around the =. Reading a variable's value requires a $ in front of its name. Every variable, whatever you put in it, is stored as a string — count=5 below stores the string "5", not a numeric type.

name="Bash"
count=5
echo "$name $count"
Output
Bash 5

What the real mistake looks like

Adding spaces around the = isn't just a style choice Bash dislikes — it changes what the line means entirely. name = "Bash" is parsed as a command called name, given two arguments = and Bash, not as an assignment. This is genuinely what the real run reports — captured from a real execution, not written to look plausible:

name = "Bash"
echo "$name"
Output
script.sh: line 1: name: command not found

Notice the script didn't stop there — echo "$name" on line 2 still ran, printing an empty line, since name was never actually assigned. Bash is forgiving by default: a failing command doesn't halt the script unless you explicitly opt into stricter behavior, which the error-handling lesson later in this course covers.

Next: quoting — single quotes versus double quotes, and capturing a command's output with command substitution.

Practice exercise

Declare a variable name set to "Bash" and a variable version set to 5, then print them separated by a space: Bash 5.