I use sed
with <<<
and read
to assign all words in a string to variables. What I do is:
read -a A0 <<< $(sed '2q;d' /proc/stat)
Hence, sed
reads the second line of the file file
and immediately quits. The line sed
has read in is fed to <<<
which does expands the input it receives from sed
and read -a
assign the resulting values of <<<
to elements of an array. Is the usage of <<<
and sed
in this way a good idea or are there obvious reasons that speak against this and most of all, is there a faster way to do this?