Unix Shell Scripts   «Prev  Next»

Shell Script File Permissions - Quiz

Shell script file permissions and execution

Each question is worth one point. Select the best answer or answers for each question.
1. Why does executing a shell script require either a period-slash (./) or the sh command?
Please select the best answers.
  A. It ensures that the script can be located and executed correctly.
  B. The period makes the script a hidden file for secure execution.
  C. The PATH variable must be referred to in order to locate the shell script.
  D. The sh command starts a shell regardless of whether the included filename is a script or not.

2. Why are comments useful within scripts? Choose all correct answers:
Please select all the correct answers.
  A. To guide others who might be using your scripts.
  B. To remind you of what your script does when you review it months later.
  C. To provide self documenting variables.
  D. To make the script easier to read by breaking up command blocks with white space.

3. How can you determine the file permissions of a script file?
Please select the best answers.
  A. By using the echo command to write that information to the screen.
  B. By using the chmod command to print the permissions.
  C. By using the read command to collect new file permissions from the system administrator.
  D. By using the ls -l command to view the detailed listing of the script filename.

4. Which of these commands will set the correct file permission for a script file named welcome: Please select the best answers.
  A. ls -lx welcome
  B. chmod o-x welcome
  C. chmod a+x welcome
  D. chmod u+x welcome.sh