test.sh
#!/bin/bash
your_name="runoob"
# Use double quotes to splice
greeting="hello, "$your_name" !"
greeting_1="hello, ${your_name} ! "
echo $greeting $greeting_1
# Use single quotes to splice
greeting_2='hello, '$your_name' !'
greeting_3='hello, ${your_name} ! '
echo $greeting_2 $greeting_3
Output
bogon:Desktop macname$ ./test.sh
hello, runoob ! hello, runoob !
hello, runoob ! hello, ${your_name} !
#!/bin/bash
your_name="runoob"
# Use double quotes to splice
greeting="hello, "$your_name" !"
greeting_1="hello, ${your_name} ! "
echo $greeting $greeting_1
# Use single quotes to splice
greeting_2='hello, '$your_name' !'
greeting_3='hello, ${your_name} ! '
echo $greeting_2 $greeting_3
bogon:Desktop macname$ ./test.sh
hello, runoob ! hello, runoob !
hello, runoob ! hello, ${your_name} !