Oracle Linux 6 System Administration — Question 5
The dailyrun.sh Bash shell script has the permissions as listed here:
-rw-r- -r- - 1 hr hradmin 8 Apr 2 06:57 dailyrun.sh
Which three methods will be successful at avoiding permissions errrors when attempting to run the script? (Choose three.)
Answer options
- A. executing the shell script using an alias created with the alias dailyrun=’bash dailyrun.sh’
- B. executing the shell script using an alias created with the alias dailyrun=dailyrun.sh
- C. executing the shell script from the shell prompt using the bash command
- D. executing the shell script from the shell prompt using the sh command
- E. executing the shell script from within a shell function using an alias created with the alias dailyrun=’dailyrun.sh’
Correct answer: A, C, D
Explanation
The correct methods to avoid permission errors are A, C, and D. Option A uses the bash command to execute the script, which is valid given the script's read permissions. Options C and D also correctly invoke the script using their respective shells. Options B and E do not employ a method that bypasses the permission issue, as they rely on the script being directly executable.