LFCS Exam QuestionsBrowse all questions from this exam

LFCS Exam - Question 140


What is the output of the following command?

for token in a b c; do

echo -n ${token};

done

Show Answer
Correct Answer: B

The output of the command 'for token in a b c; do echo -n ${token}; done' will be 'abc'. The 'for' loop iterates over the tokens 'a', 'b', and 'c', and 'echo -n ${token}' prints each token without a newline in between. Hence, the output is the concatenation of 'a', 'b', and 'c' resulting in 'abc'.

Discussion

1 comment
Sign in to comment
Greenmile84Option: B
Jan 17, 2024

~$ for token in a b c; do > echo -n ${token}; > done abc