What is the cause of this error?

The dailyrun.sh shell script run by the user hr on a daily basis suddenly returns an error.
You investigate this by running the commands manually as user hr and discovered that this line of
shell cod is responsible:
1s –als > /home/prodrun/files.1st
Bash: files.1st:cannot overwrite existing file
What is the cause of this error?

The dailyrun.sh shell script run by the user hr on a daily basis suddenly returns an error.
You investigate this by running the commands manually as user hr and discovered that this line of
shell cod is responsible:
1s –als > /home/prodrun/files.1st
Bash: files.1st:cannot overwrite existing file
What is the cause of this error?

A.
The hr user has no write permissions on the /home/prodrun/files.1st file.

B.
The hr user has no write permissions on the /home/prodrun directory.

C.
The dailyrun.sh shell script has the setuid bit turned off.

D.
The hr user environment has set on the noclobber option.

Explanation:



Leave a Reply 2

Your email address will not be published. Required fields are marked *


lilacmega

lilacmega

The answer is D
================

How do I set noclobber option to prevent overwriting files on bash shell?

Open the Terminal and type the following command:
$ set -o noclobber
Create a test file:
$ echo “foo bar”> output.txt
Next, try to write to a file called output.txt:
$ cat > output.txt
OR
ls -l > output.txt
Sample outputs:

bash: output.txt: cannot overwrite existing file