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
4 months ago
I agree with B, it's how positional parameters work.
upvoted 0 times
...
Tenesha
5 months ago
Wait, are you sure? I thought it would be A.
upvoted 0 times
...
Crissy
5 months ago
Definitely B! It prints in reverse order.
upvoted 0 times
...
Floyd
5 months ago
I’m surprised it doesn’t just print the script name!
upvoted 0 times
...
Leanora
5 months ago
The output will be test2 test1.
upvoted 0 times
...
Chantay
5 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
6 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
6 months ago
I'm not entirely sure, but I remember something about the order of arguments being important.
upvoted 0 times
...
Daisy
6 months ago
I think the script uses positional parameters, so $1 is the first argument and $2 is the second.
upvoted 0 times
...
Oneida
6 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
6 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
7 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
7 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
7 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
10 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
10 months ago
I'm not sure, but I think the answer is B) test2 test1 as well.
upvoted 0 times
...
Cory
10 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
9 months ago
Bash scripts can be tricky, but this one is pretty straightforward.
upvoted 0 times
...
Janae
9 months ago
Yeah, that script is just swapping the arguments around.
upvoted 0 times
...
Gilbert
10 months ago
I think you're right, B) test2 test1 is the correct output.
upvoted 0 times
...
...
Bettyann
10 months ago
I agree with Laurel, because the script will echo the second argument first.
upvoted 0 times
...
Shaniqua
10 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
10 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
10 months ago
User 2: Yeah, that makes sense. The script is just swapping the arguments.
upvoted 0 times
...
Beata
10 months ago
User 1: I think it will output test2 test1.
upvoted 0 times
...
...
Coral
11 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
11 months ago
I think the output will be B) test2 test1.
upvoted 0 times
...
Glory
11 months ago
Hmm, this looks like a classic shell script argument handling question. I'll go with B) test2 test1.
upvoted 0 times
Laurena
9 months ago
User4: I agree with User2, it should be B) test2 test1.
upvoted 0 times
...
Nelida
9 months ago
User3: I'm not sure, but I think it might be C) script.sh test2.
upvoted 0 times
...
Latricia
10 months ago
User2: No, I believe it will be B) test2 test1.
upvoted 0 times
...
Roslyn
10 months ago
User1: I think the output will be A) test1 test2.
upvoted 0 times
...
...

Save Cancel