bash echo variable code example
Example 1: linux shell echo command with varia ble
echo “A is $var1 and B is $var2”
Example 2: echo variable bash
echo "${var}"
Example 3: bash echo in variable
var=$(command)
var=$(echo 'hi')
var=$(ls)
Example 4: print variable in bash
echo
echo "When single quote is used with string:"
invitation='Welcome to javatpoint'
echo $invitation
echo
echo "When double quote is used with string:"
invitation="Welcome to javatpoint"
echo $invitation
echo
echo "When variable is used with double quote:"
Remark="Hello User!, $invitation"
echo $Remark
echo
echo "When variable is used with single quote:"
Remark='Hello User!, $invitation'
echo $Remark
echo