Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation LFCS Exam - Topic 5 Question 100 Discussion

Actual exam question for Linux Foundation's LFCS exam
Question #: 100
Topic #: 5
[All LFCS Questions]

The script, script.sh, consists of the following lines:

#!/bin/bash

echo $2 $1

Which output will appear if the command, ./script.sh test1 test2, is entered?

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

0/2000 characters
Felix
3 months ago
I agree with B, it's how positional parameters work.
upvoted 0 times
...
Tenesha
3 months ago
Wait, are you sure? I thought it would be A.
upvoted 0 times
...
Crissy
3 months ago
Definitely B! It prints in reverse order.
upvoted 0 times
...
Floyd
4 months ago
I’m surprised it doesn’t just print the script name!
upvoted 0 times
...
Leanora
4 months ago
The output will be test2 test1.
upvoted 0 times
...
Chantay
4 months ago
I might be confused, but I thought the script would just print the script name instead of the arguments.
upvoted 0 times
...
Glendora
4 months ago
I practiced a similar question, and I believe it outputs the second argument first, so it should be test2 test1.
upvoted 0 times
...
Rosann
4 months ago
I'm not entirely sure, but I remember something about the order of arguments being important.
upvoted 0 times
...
Daisy
5 months ago
I think the script uses positional parameters, so $1 is the first argument and $2 is the second.
upvoted 0 times
...
Oneida
5 months ago
I think the key here is understanding how the shell script is processing the arguments. Since the script is using $2 and $1, the output should be "test2 test1". I'm feeling pretty good about this one.
upvoted 0 times
...
Charlena
5 months ago
Hmm, let me think this through. The script is using $2 and $1, so the order of the arguments passed to the script must be important. I'll need to carefully consider the order of the arguments to determine the correct output.
upvoted 0 times
...
Glenna
5 months ago
Okay, I've got this. The script is echoing the second argument ($2) followed by the first argument ($1), so the output should be "test2 test1". I'm confident that's the correct answer.
upvoted 0 times
...
Casandra
5 months ago
I'm a bit confused here. The script is using $2 and $1, but I'm not sure which one corresponds to the first and second arguments passed to the script. I'll need to double-check the order of the arguments.
upvoted 0 times
...
Timmy
5 months ago
Hmm, this looks straightforward. I think the output will be "test2 test1" since the script is echoing the second argument followed by the first argument.
upvoted 0 times
...
Mozelle
9 months ago
Alright, let's think this through. The script is echoing the arguments in reverse order, so B) test2 test1 is the correct output. Easy peasy, lemon squeezy!
upvoted 0 times
...
Alease
9 months ago
I'm not sure, but I think the answer is B) test2 test1 as well.
upvoted 0 times
...
Cory
9 months ago
This is a no-brainer! The script is just reversing the order of the arguments, so B has to be the right answer. *chuckles* Bash scripts, gotta love 'em!
upvoted 0 times
Erick
8 months ago
Bash scripts can be tricky, but this one is pretty straightforward.
upvoted 0 times
...
Janae
8 months ago
Yeah, that script is just swapping the arguments around.
upvoted 0 times
...
Gilbert
8 months ago
I think you're right, B) test2 test1 is the correct output.
upvoted 0 times
...
...
Bettyann
9 months ago
I agree with Laurel, because the script will echo the second argument first.
upvoted 0 times
...
Shaniqua
9 months ago
Let's see, the script is echoing the arguments in reverse order. That means B) test2 test1 is the correct answer. *fingers crossed*
upvoted 0 times
...
Shanice
9 months ago
I'm feeling confident about this one. The script is clearly just swapping the order of the arguments, so B is the way to go.
upvoted 0 times
Krissy
8 months ago
User 2: Yeah, that makes sense. The script is just swapping the arguments.
upvoted 0 times
...
Beata
8 months ago
User 1: I think it will output test2 test1.
upvoted 0 times
...
...
Coral
9 months ago
Woah, hold up! If the script is echoing the arguments in reverse order, then the answer has to be B. Easy peasy!
upvoted 0 times
...
Laurel
9 months ago
I think the output will be B) test2 test1.
upvoted 0 times
...
Glory
9 months ago
Hmm, this looks like a classic shell script argument handling question. I'll go with B) test2 test1.
upvoted 0 times
Laurena
8 months ago
User4: I agree with User2, it should be B) test2 test1.
upvoted 0 times
...
Nelida
8 months ago
User3: I'm not sure, but I think it might be C) script.sh test2.
upvoted 0 times
...
Latricia
9 months ago
User2: No, I believe it will be B) test2 test1.
upvoted 0 times
...
Roslyn
9 months ago
User1: I think the output will be A) test1 test2.
upvoted 0 times
...
...

Save Cancel