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-20-2009, 03:12 PM   #1
DarDevy
LQ Newbie
 
Registered: Apr 2009
Posts: 1

Rep: Reputation: 0
would and could somebody help me with my homework assignment please...


1. Write a shell script named ches (for change to executable) that takes a file or directory name as an argument and makes it executable. This is just a single command. All you need to do here is to take whatever the existing permissions are and add execute permissions for all users. The best way to do this is to use the symbolic mode rather than the octal mode for the chmod command, since you only want to change the permissions relative to their current setting. Test your script on several files before proceeding.

2. Expand your chex script to handle multiple arguments and name it chexm. Look up the options for the chmod command and add the correct option to your script so that it will display what it has done.

Would someone here be able to help me with these questions?

Thanks,

DD
 
Old 04-20-2009, 03:19 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The basic commands you need are supplied by the coreutils package. Every linux system has this package installed. Read through the info manual.

This site has a policy against doing peoples homework. It seems that if you don't know how the change the permissions or a directory, that you haven't been following your course work.

Also peruse the the bash info manual. It contains information you may need about what a script looks like.

If you use KDE, you can read an info manual in konqueror by entering `info:<topic>'. info:coreutils, for example. You may find it easier to read the html version.
 
Old 04-20-2009, 03:41 PM   #3
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,052

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
Quote:
Originally Posted by DarDevy View Post
1...that takes a file or directory name as an argument and makes it executable...
hmmm, maybe you want to explain to me why you would want to execute a directory...


Quote:
This is just a single command. All you need to do here is to take whatever the existing permissions are and add execute permissions for all users. The best way to do this is to use the symbolic mode rather than the octal mode...
What is wanted here seems well explained. In line with the general statute of limitations on homework, I am not prepared to do your homework for you. If, however, you want to explain what aspect of this you find baffling and what elements you can get your head around, I might be able to find a way of offering some pointers.

The question that you might ask yourself, is do you know enough to be able to do this manually, at the commnd line, without the complication of writing a script for this? If not, it seems unlikely that you will be able to write a script to do it. If not, maybe a little time with the man pages may offer a little enlightenment.

Once you are familiar with the manual useage of the command, developing a script should not normally be that hard, although you might do well to think about what can go wrong (what if the file does not exist? what if it already has the properties that you want to give it, should you, for example, notify the user? what if the user has specified a string including wildcards that matches more than one file? what if the user doesn't have the rights to do what they have specified to the file? and so on...you may decide that you don't care about some of these, but it should be the result of an assesment of the risks and the difficulty)
 
Old 04-20-2009, 03:43 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.

I normally close "cut and paste" homework questions----In this case, if OP responds to what has been asked, we can see where it leads.......
 
  


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
help with homework ch4920 Programming 2 04-29-2008 09:57 AM
help w/ homework ch4920 Linux - Newbie 5 04-29-2008 09:01 AM
Newbie homework assignment longs_peak2002 Linux - Newbie 13 11-14-2007 12:19 AM
help me with my homework assignment by filling in the blank nkoplm General 11 11-25-2005 11:57 AM
please help my homework again donotexpert Programming 7 08-23-2005 11:26 AM


All times are GMT -5. The time now is 10:01 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