I have variable $OUTPUT=abc PHYSIN=lalala ghi
How can I extract the value of PHYSIN
into another new variable called VETH_NAME
,
in other words, I'd like VETH_NAME
to be lalala
How can I do so using bash commands?
Thanks
I have variable $OUTPUT=abc PHYSIN=lalala ghi
How can I extract the value of PHYSIN
into another new variable called VETH_NAME
,
in other words, I'd like VETH_NAME
to be lalala
How can I do so using bash commands?
Thanks
Assuming this is what you are saying :
OUTPUT="abc"
PHYSIN="lalala ghi"
VETH_NAME=$(echo "$PHYSIN" | cut -d" " -f1)
finally :
echo $VETH_NAME
lalala
Use parameter expansion with the %%
operator, which drops the longest matching suffix from the expansion.
OUTPUT=abc
PHYSIN="lalala ghi"
VETH_NAME=${PHYSIN%% *}