Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

linux bash assign variable

# Example:
MY_VAR=a    # here you assigned the value 'a' to MY_VAR
echo $MY_VAR
echo MY_VAR
# output:
a
MY_VAR
# good practice says to name variable in all caps to differ from commands
# if you want to print to print to console the value of MY_VAR, you must use $
# if you echo without using $, the name of the variable will be printed
# not the value
Source by www.tldp.org #
 
PREVIOUS NEXT
Tagged: #linux #bash #assign #variable
ADD COMMENT
Topic
Name
5+2 =