echo variable in shell script 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: shell script variable
TEXT="Hello World!"
echo $TEXT
# ouput: Hello World!
Example 4: bash echo in variable
#Just use following structure to store output of command into a variable:
var=$(command)
#For example:
var=$(echo 'hi') #store hi into var
var=$(ls) #store list of files into var