Store output from command in variable in Bash. The output is being run instead of stored -
i trying store output command in bash in variable, instead of storing output being interpreted command , run. not want.
tmp="$($line | awk '{print $1}')"
runs output awk
command.
echo $line | awk '{print $1}'
prints out output want store in variable.
how can output second line stored in variable?
you're looking this:
tmp=$(echo "$line" | awk '{print $1}')
but that's useless use of echo. use here-string instead:
tmp=$(awk '{print $1}' <<< "$line")
Comments
Post a Comment