Result: 3 2 1
Here's what's happening:
The echo '1 2 3 4 5 6' command outputs the string 1 2 3 4 5 6 to the standard output.
The pipe | symbol is used to redirect the standard output of the echo command as the standard input to the next command in the sequence, which is the while loop.
The while loop reads from the standard input, and read is used to read three values at a time from the standard input into the variables a, b, and c.
The do keyword starts the body of the while loop, which contains the echo command echo result: $c $b $a. This echo command outputs the values of c, b, and a in reverse order, separated by spaces.
The while loop continues to run until there is no more input to read from the standard input. In this case, after three iterations, all of the input has been processed, and the loop terminates.
The final result is the output of the last echo command in the loop, which is result: 3 2 1.
This section is not available anymore. Please use the main Exam Page.LX0-104 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
linux_admin
2 years, 2 months agolinux_admin
2 years, 2 months ago