Linux Essentials (010-160) — Question 50
The current directory contains the following file:
-rwxr-xr-x 1 root root 859688 Feb 7 08:15 test.sh
Given that the file is a valid shell script, how can this script be executed? (Choose two.)
Answer options
- A. run test.sh
- B. ${test.sh}
- C. cmd ./test.sh
- D. ./test.sh
- E. bash test.sh
Correct answer: D, E
Explanation
The correct methods to execute the script are './test.sh' and 'bash test.sh'. Option D directly runs the script from the current directory, while option E uses bash to execute it. Options A, B, and C are invalid commands for executing a shell script in this context.