LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Write a short script that tells you whether the permissions for two files whose names (https://www.linuxquestions.org/questions/linux-newbie-8/write-a-short-script-that-tells-you-whether-the-permissions-for-two-files-whose-names-873019/)

aven 04-04-2011 11:58 PM

Write a short script that tells you whether the permissions for two files whose names
 
Write a short script that tells you whether the permissions for two files, whose names are given as arguments to the script, are identical. If the permissions for the two files are identical, output the common permission field. Otherwise, output each filename followed by its permission field

Telengard 04-05-2011 12:00 AM

/me smells a school assignment

Edit
Many solutions are possible, especially because you did not specify which language and commands you want to use. Here are some hints.
  • You can display the permissions of files with ls.
  • The output of ls can be parsed with cut.
  • The output of any command may be captured and assigned to a variable with command substitution.
  • The test command provides a number of operators to enable conditional execution.

HTH

Ignotum Per Ignotius 04-05-2011 05:31 AM

Quote:

Write a short script that tells you whether the permissions for two files, whose names are given as arguments to the script, are identical. If the permissions for the two files are identical, output the common permission field. Otherwise, output each filename followed by its permission field
"Write a short script..."?! "Write a short script..."?!!! No "please" or "thank you", or "I would be grateful if..."? What is the meaning of this?! Why, you have simply cut & pasted your class assignment --- how could you!

Fie! Impudent crumb! You are lucky that mighty Telengard didn't growl through his fiery moustache and smite you with his warhammer...

Aroint thee, saucy timewaster, and see to thine own homework!

...And don't post in the imperative.

brownie_cookie 04-05-2011 05:35 AM

Quote:

Originally Posted by Ignotum Per Ignotius (Post 4314386)
"Write a short script..."?! "Write a short script..."?!!! No "please" or "thank you", or "I would be grateful if..."? What is the meaning of this?! Why, you have simply cut & pasted your class assignment --- how could you!

Fie! Impudent crumb! You are lucky that mighty Telengard didn't growl through his fiery moustache and smite you with his warhammer...

Aroint thee, saucy timewaster, and see to thine own homework!

...And don't post in the imperative.

somebody is a little grumpy :p but you're right ;)

Telengard 04-05-2011 12:30 PM

Quote:

Originally Posted by Ignotum Per Ignotius (Post 4314386)
You are lucky that mighty Telengard didn't growl through his fiery moustache and smite you with his warhammer...

My warhammer is reserved for worthy adversaries only.
:D

chrism01 04-05-2011 08:03 PM

Like those who correct your spelling?

advesaries -> adversaries

;)


All times are GMT -5. The time now is 12:00 AM.