Linux Foundation Certified System Administrator (LFCS) — Question 25

What output will the following command sequence produce?
echo '1 2 3 4 5 6' | while read a b c; do
echo result: $c $b $a;
done

Answer options

Correct answer: A

Explanation

The command reads the input values into variables a, b, and c in that order. In this case, c gets the third value (3), b gets the second value (2), and a gets the first value (1), resulting in the output 'result: 3 4 5 6 2 1'. The other options are incorrect as they do not reflect the correct order of variable assignment.