Exam LFCS All QuestionsBrowse all questions from this exam
Question 139

What is the output of the following command sequence?

for token in a b c; do

echo -n "$token ";

done

    Correct Answer: B

    The command sequence iterates over the tokens 'a', 'b', and 'c'. The 'echo -n' command prints each token followed by a space, without a newline at the end. Therefore, the output will be 'a b c '.

Discussion
Greenmile84Option: B

Here the output for token in a b c; do echo -n "$token "; done There is a space between token and ", if no space, then the answer is abc.

EliteAllenOption: B

The given answer is correct

ilovelucyOption: B

This is incorrect. Replace the first line with "for token in "a " "b " "c " yada yada B is the right answer. As shown the answer is abc