linux - Assign the output of command to variable -
i have cut string after white-space , store value before white-space. example script show below
tstring="this name" echo $tstring | cut -d' ' -f1
output:
this
now want assign output value variable. script
tstring="this name" var=$($tstring | cut -d' ' -f1)
it shows error.error message
this: command not found
iam new bash shell script. knows how this.
add echo
:
tstring="this name" var=$(echo $tstring | cut -d' ' -f1)
(also mentioned here 2 seconds before posted answer)
Comments
Post a Comment