Computer Science - Unix - Discussion

Discussion :: Unix - Section 1 (Q.No.5)

5. 

Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3?

[A]. chmod u+x emp[1-3]
[B]. chmod 777 emp*
[C]. chmod u+r ??? emp
[D]. chmod 222 emp?
[E]. None of the above

Answer: Option A

Explanation:

No answer description available for this question.

Tapajyoti said: (Jul 15, 2014)  
Chmod u+x somefile. Will grant only the owner of that file execution permissions. Here you stands for user and emp denotes that the file starts with a string emp and [1-3] means that it may end with any of 1, 2 or 3.

Arnab Pathak said: (Jan 15, 2015)  
As far as I think chmod u+x emp[l-3] will match any combination of emp1, emp2, emp3, emp4, as well as others because it will choose the string which contains the above pattern.

But according to the question chmod u+x^emp.*[l-3]$ will give all employees starting with emp and ending with 1-3.

Priyabrata Behera said: (Apr 2, 2015)  
The answer here should be: [E]. None of the above (As the correct answer is: chmod u+x emp*[1-3]).

- emp from the beginning will give the files only those are starting with emp string.

- [1-3] at the end will give only the files those are ending with either 1 or 2 or 3.

- In between the symbol * will give any character or string between emp and 1/2/3.

So emp*[1-3] will give the output of combinations like "emp1, emp2, emp3, empHello1, employee1, employee2, etc". Mark here, these strings are starting with emp and ending with 1, 2 or 3.

Sonu said: (Jul 26, 2015)  
The answer answered by you, that one is wrong I think. Could you please clarify?

Shekhar said: (Nov 22, 2015)  
chmod u+x emp[1-3] would give user permission to execute files starting with string "emp" & ending with either 1, 2 or 3.

Option A.

Linda said: (Jun 1, 2016)  
May I know the protection mode in the file permission.

Please explain that, I am confused.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.