Computer Science - Unix - Discussion

Discussion Forum : Unix - Section 1 (Q.No. 5)
Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3?
chmod u+x emp[1-3]
chmod 777 emp*
chmod u+r ??? emp
chmod 222 emp?
None of the above
Answer: Option
No answer description is available. Let's discuss.
7 comments Page 1 of 1.

Shekhar Yewale said:   2 years ago
U+x means adding execute (x) permission to user(u), if they have read permission then the final result is read and execute permission.

Linda said:   7 years ago
May I know the protection mode in the file permission.

Please explain that, I am confused.

Shekhar said:   7 years ago
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.

Sonu said:   8 years ago
The answer answered by you, that one is wrong I think. Could you please clarify?

Priyabrata Behera said:   8 years ago
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.

Arnab Pathak said:   8 years ago
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.

Tapajyoti said:   9 years ago
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.

Post your comments here:

Your comments will be displayed after verification.