Bash · lesson 2 of 30 · First stepsKeep a value in a variable
No spaces around =. Double quotes keep the spaces and fill in $name; single quotes leave $name as it is.
02-variables.sh Download 02-variables.sh
#!/usr/app/TurboShell/bin/bash
# No spaces around =. Quotes keep the spaces of a value together.
name="Holiday photos"
files=3
echo "$name: $files files"
echo "with braces: ${files}x"
echo 'single quotes keep it as it is: $name'
readonly name
Terminal
$ bash 02-variables.sh
Holiday photos: 3 files
with braces: 3x
single quotes keep it as it is: $nameExercise
Print your name from a variable in a sentence.