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.)
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.
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)
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
This section is not available anymore. Please use the main Exam Page.101-500 Exam Questions
Log in to ExamTopics
Sign in:
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.
Negator
Highly Voted 4 years, 1 month agoCuriousLinuxCat
Highly Voted 3 years, 9 months agoAleksandre
Most Recent 9 months, 4 weeks agoNinymo
1 year, 1 month agoMchoeti
2 years, 1 month agojsteven845
4 years, 2 months agomriron
4 years, 4 months agoMIU
4 years, 5 months agoilputto
4 years, 6 months agoVendo
4 years, 8 months agosnota45
4 years, 9 months agoVano1
4 years, 9 months agoVano1
4 years, 9 months agoVano1
4 years, 9 months agodeewetdvjbmnjkjytfdszxc
4 years, 9 months ago