exam questions

Exam 101-500 All Questions

View all questions & answers for the 101-500 exam

Exam 101-500 topic 1 question 40 discussion

Actual exam question from LPI's 101-500
Question #: 40
Topic #: 1
[All 101-500 Questions]

From a Bash shell, which of the following commands directly execute the instructions from the file /usr/local/bin/runme.sh without starting a subshell?
(Choose two.)

  • A. source /usr/local/bin/runme.sh
  • B. /usr/local/bin/runme.sh
  • C. /bin/bash /usr/local/bin/runme.sh
  • D. . /usr/local/bin/runme.sh
  • E. run /usr/local/bin/runme.sh
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Negator
Highly Voted 3 years, 11 months ago
Create a script that outputs the shell level environmental variable using "echo $SHLVL". When you execute this script using source or dot (.) it will display 1 showing that the script was executed in the current shell. When you execute the script using full path it will show 2, showing that the script was executed in a subshell.
upvoted 9 times
...
CuriousLinuxCat
Highly Voted 3 years, 7 months ago
A and D is correct. source and . tested on Ubuntu.
upvoted 5 times
...
Aleksandre
Most Recent 7 months, 4 weeks ago
Maybe something changed here. Correct answer is A and B tried on arch linux. running bash script using absolute path does not creates subshell (does not increments $SHLVL variable)
upvoted 1 times
...
Ninymo
11 months, 3 weeks ago
Answer: AD
upvoted 1 times
...
Mchoeti
1 year, 11 months ago
right A and D
upvoted 1 times
...
jsteven845
4 years ago
A and D
upvoted 3 times
...
mriron
4 years, 2 months ago
A and D are correct, assuming there is a space after (.) point for D . B is wrong , because it execute in the kind shell not in current shell
upvoted 2 times
...
MIU
4 years, 3 months ago
A and D are correct. When you try, just copy and paste from the question. You guys sometimes typo when you try then on your environment....
upvoted 1 times
...
ilputto
4 years, 4 months ago
the correct one is A and D. source <script> and . ./<script> are equivalent
upvoted 4 times
...
Vendo
4 years, 7 months ago
When a script is run using source it runs within the existing shell, any variables created or modified by the script will remain available after the script completes. source is a synonym for dot/period '.' in bash. Be careful! ./ and source are not quite the same. ./script runs the script as an executable file, launching a new shell to run it https://ss64.com/bash/source.html
upvoted 4 times
...
snota45
4 years, 7 months ago
it is A & C
upvoted 1 times
...
Vano1
4 years, 7 months ago
The correct answer is A, B. Verified on CentOS7.
upvoted 1 times
Vano1
4 years, 7 months ago
D is correct if between . (dot) and /usr/loca/bin/runme.sh is a space. This question have 3 correct answer or I don't understand something.
upvoted 2 times
Vano1
4 years, 7 months ago
After some researchers, I choose A and D.
upvoted 3 times
...
...
...
deewetdvjbmnjkjytfdszxc
4 years, 7 months ago
Isn't A+B?
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago