Concept Flow - String variables
Declare variable
Assign string value
Use variable
Print or manipulate string
End
This flow shows how a string variable is declared, assigned, used, and printed in bash scripting.
name="Alice" echo "Hello, $name!"
| Step | Action | Variable 'name' | Output |
|---|---|---|---|
| 1 | Declare and assign name="Alice" | Alice | |
| 2 | Print greeting with echo | Alice | Hello, Alice! |
| 3 | End of script | Alice |
| Variable | Start | After Step 1 | After Step 2 | Final |
|---|---|---|---|---|
| name | undefined | Alice | Alice | Alice |
String variables in bash: - Assign with: name="value" - Use with $name - Use double quotes to preserve spaces and expand variables - Print with echo "Hello, $name!" - Without $, variable name prints literally