To store the output of a command to a variable in shell script(also called as command substitution), there are two methods possible
1) Using backquotes ``
2) Using $( )
Let us see how
# arch=`uname -m`
# echo $arch
x86_64
# arch=$(uname -m)
# echo $arch
x86_64
1) Using backquotes ``
2) Using $( )
Let us see how
# arch=`uname -m`
# echo $arch
x86_64
# arch=$(uname -m)
# echo $arch
x86_64
No comments:
Post a Comment