nerdexam
Exams350-201Questions#20
Cisco

350-201 · Question #20

350-201 Question #20: Real Exam Question with Answer & Explanation

The correct answer is A: chmod +x ex.sh. The 'permission denied' error indicates the script file lacks execute permission. The chmod +x command grants that permission so the script can be run directly.

Question

An engineer has created a bash script to automate a complicated process. During script execution, this error occurs: permission denied. Which command must be added to execute this script?

Options

  • Achmod +x ex.sh
  • Bsource ex.sh
  • Cchroot ex.sh
  • Dsh ex.sh

Explanation

The 'permission denied' error indicates the script file lacks execute permission. The chmod +x command grants that permission so the script can be run directly.

Common mistakes.

  • B. source reads and executes the script in the current shell context without requiring the execute bit, but it does not grant execute permission and is not the standard fix for a permission denied error.
  • C. chroot changes the apparent root directory for a running process and has no relationship to file execute permissions.
  • D. sh ex.sh invokes the shell interpreter directly with the script as an argument and bypasses the execute permission check, but it does not add execute permission to the file itself as the question requires.

Concept tested. Linux file execute permissions using chmod

Reference. https://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html

Community Discussion

No community discussion yet for this question.

Full 350-201 Practice