QuestionQ19

Shells and Shell Scripting

From a Bash shell, which of the following commands execute the instructions in /usr/local/bin/runme.sh directly without launching 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
Explanation

The . builtin reads and executes commands from its filename argument in the current shell context, and Bash defines source as equivalent to .. Thus both commands apply the script’s commands to the existing shell rather than starting another shell process.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!