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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -