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.)
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.)
In Bash, the commands 'source' and '.' are used to execute a script in the current shell. 'source /usr/local/bin/runme.sh' reads and executes the instructions from the script in the current shell, meaning any changes to the environment by the script persist after the script finishes. Similarly, '. /usr/local/bin/runme.sh' does the same thing; the dot (.) is an alternative to the 'source' command in Bash. Both do not start a new subshell, ensuring the script runs within the current shell environment.
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.
A and D is correct. source and . tested on Ubuntu.
the correct one is A and D. source <script> and . ./<script> are equivalent
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
A and D
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
Isn't A+B?
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)
Answer: AD
right A and D
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....
it is A & C
The correct answer is A, B. Verified on CentOS7.
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.
After some researchers, I choose A and D.