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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -