Variables and quoting
Bash assigns a variable with name=value, without spaces around the equals sign. Expansion such as "$name" substitutes its value while preserving it as one argument. Unquoted expansions can undergo word splitting and filename expansion. Prefer printf over echo for predictable formatted output. Environment variables are exported to child processes deliberately. name="Ada Lovelace"; printf "Hello, %s\n" "$name" preserves the two-word name as one argument rather than two separate words. Quoting makes scripts behave consistently for spaces and wildcard characters and prevents user-controlled values from accidentally becoming several paths or options during routine processing tasks. Writing name = value attempts to run a command named name; quote expansions and keep assignment syntax compact instead of treating Bash like Python.
name="Ada Lovelace"; printf "Hello, %s\n" "$name" preserves the two-word name as one argument rather than two separate words.
Quoting makes scripts behave consistently for spaces and wildcard characters and prevents user-controlled values from accidentally becoming several paths or options during routine processing tasks.
Writing name = value attempts to run a command named name; quote expansions and keep assignment syntax compact instead of treating Bash like Python.