shell variables

Can use single-byte alphanumeric characers and underscores as variable name. a to z, A to Z, 0 to 9 and _.
When giving a value to a variable, write = without leading and trailing blanks. If it is a string, enclose it in “.
Put $ before the variable name when accessing the variable. or put $ and enclose the variable in {}.
Only one value can be stored in one variable.
Use readonly to not overwrite the value of the variable. Variables can be deleted by unset. (You can not delete the readonly variable.)

#!/bin/sh

var="yukijirushi"
var2="coffee"
echo "I'm drinking $var2"

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
I’m drinking coffee

なるほど。

#!/bin/sh

var="yukijirushi"
var2="coffee"
echo "I'm drinking $var2"

var2="traditional test"
echo ${var2}

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
I’m drinking coffee
traditional test

ここまでは簡単