LFCS Exam QuestionsBrowse all questions from this exam

LFCS Exam - Question 139


What is the output of the following command sequence?

for token in a b c; do

echo -n "$token ";

done

Show Answer
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

3 comments
Sign in to comment
ilovelucyOption: B
Aug 27, 2020

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

EliteAllenOption: B
Jan 3, 2024

The given answer is correct

Greenmile84Option: B
Jan 17, 2024

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.