LFCS · Question #788
All of the following commands will execute the bash script /usr/local/bin/runme.sh EXCEPT:
The correct answer is E. run /usr/local/bin/runme.sh. The run command is not a standard Linux utility for executing scripts; all other options are valid ways to run a bash script.
Question
Options
- Asource /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
- Erun /usr/local/bin/runme.sh
How the community answered
(28 responses)- B4% (1)
- D7% (2)
- E89% (25)
Why each option
The `run` command is not a standard Linux utility for executing scripts; all other options are valid ways to run a bash script.
`source /usr/local/bin/runme.sh` executes the script in the current shell environment.
`. /usr/local/bin/runme.sh` is an alias for `source` and also executes the script within the current shell.
`/bin/bash /usr/local/bin/runme.sh` explicitly invokes the bash interpreter to run the script.
`/usr/local/bin/runme.sh` executes the script directly, provided it has execute permissions and a valid shebang line.
`run` is not a standard Linux command or shell built-in for script execution and would typically result in a 'command not found' error.
Concept tested: Linux script execution methods
Source: https://man7.org/linux/man-pages/man1/bash.1.html
Topics
Community Discussion
No community discussion yet for this question.