LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2011, 12:58 AM   #1
aven
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
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
 
Old 04-05-2011, 01:00 AM   #2
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
/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

Last edited by Telengard; 04-05-2011 at 01:21 AM.
 
1 members found this post helpful.
Old 04-05-2011, 06:31 AM   #3
Ignotum Per Ignotius
Member
 
Registered: Sep 2009
Location: Wales, UK
Distribution: Slackware
Posts: 69
Blog Entries: 3

Rep: Reputation: 42
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.
 
1 members found this post helpful.
Old 04-05-2011, 06:35 AM   #4
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
Quote:
Originally Posted by Ignotum Per Ignotius View Post
"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 but you're right
 
Old 04-05-2011, 01:30 PM   #5
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by Ignotum Per Ignotius View Post
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.

Last edited by Telengard; 04-06-2011 at 12:02 AM. Reason: Spelling of "adversaries" corrected per chrism01's request.
 
1 members found this post helpful.
Old 04-05-2011, 09:03 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Like those who correct your spelling?

advesaries -> adversaries

 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Little bash script and file to give long (or any) directories short names WardXmodem Programming 1 11-23-2009 01:24 AM
can someone help me write a short script? knoxville217 Linux - Newbie 4 03-16-2006 04:16 AM
I need to write a short script Baran Programming 9 04-22-2005 10:55 AM
How can I write a shell script to transfer files and keep permissions? LancerNZ Linux - Networking 1 02-24-2005 04:49 AM
How can I write a shell script to transfer files and keep permissions? LancerNZ Linux - Wireless Networking 0 02-24-2005 01:19 AM


All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration