bash - extract fields to variable -
i want extract fields line variables:
aaa bbb ccc
'aaa' => $a, 'bbb' => $b, 'ccc' => $c. how in bash?
i don't want pipeline processing, need extract them variables or array.
you can do:
read b c <<<"aaa bbb ccc"
output
$ echo "a=[$a] b=[$b] c=[$c]" a=[aaa] b=[bbb] c=[ccc]
as per bash manual:
here strings variant of here documents, format is: <<<word word expanded , supplied command on standard input.
Comments
Post a Comment