LPIC-1 Exam 102 (Linux Administrator) — Question 6

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 as three variables, where 'a' gets the first number (1), 'b' gets the second (2), and 'c' gets the third (3). The output format is 'result: $c $b $a', which means it will display 'result: 3 2 1', thus making option A the correct output sequence.