I have to cut the string after the white-space and store the value before white-space. My example script is show below
tString="This is my name"
echo $tString | cut -d' ' -f1
output:
This
Now I want to assign this output value to the variable. My script is
tString="This is my name"
var=$($tString | cut -d' ' -f1)
It shows error.Error message is
This: command not found
Iam new to bash shell script. Anyone Knows how to do this.
read var unused <<< $tStringwill also serve the purpose.read var unused <<< "$tString", else it may give errors on some bash'es...