LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-17-2004, 08:22 AM   #1
Jazinator
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Rep: Reputation: 0
Scripting Help Please


Hello Friends,
I am new to this forum. I am currently in school learning linux and need to write a script that will do the following: (Any help will be greatly appreciated)

I need to create a shell script called Delstar that will accept input, and check to see if the input is a directory file and is readable and writeable. If so, then all ordinary files under that directory should be listed out one by one. For each ordinary file that is writeable, the user should be asked whether or not the file is to be deleted. If the file is to be deleted then it should be deleted and the next file processed. If the file is not to be deleted then it should just move to the next file.

Thanks in advance for any help given. I just can't seem to get my head around this one. Jaz.
 
Old 10-17-2004, 09:13 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
please do not ask for help with your homework. The point of going to school / college is to learn things, not to just blindly cop someone elses work. Say someone decides to take pitty on you and gives you a full example. you copy that and hand it in.. what do you learn from that? Would you seriously take the time to read through it and teach yourself how it does it's thing? The course you are doing this for should come complete with substantial notes, of text references for you to be able to acomplish any task set within it.

http://www.linuxquestions.org/rules.php
 
Old 10-17-2004, 09:26 AM   #3
Jazinator
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
I do apologize if it seemed like I am looking for someone to do my work for me. This is not the case. I am more looking for an approach to the problem not the entire script written for me. I have tried several different things to make this work and am having no success.
 
Old 10-17-2004, 11:14 AM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Here's a hint -- look at the "test" command, assuming this is to be written in a shell script. If you're doing this in C, the stat function will help you.
 
Old 10-17-2004, 12:45 PM   #5
Draygo
Member
 
Registered: May 2004
Location: Frisco, TX
Distribution: Debian Unstable
Posts: 73

Rep: Reputation: 15
If you are just doing simple shell scripting with bash look up on your "if" and your "and" and "or" operators.
 
Old 10-17-2004, 01:12 PM   #6
brunnopessoa
Member
 
Registered: Nov 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora
Posts: 67

Rep: Reputation: 15
I encourage you to check the following website out and search for Linux bash scripting:

www.ibm.com/developerworks
 
Old 10-17-2004, 06:18 PM   #7
Jazinator
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you to all for your help. It has been invaluable.
 
Old 10-17-2004, 06:35 PM   #8
brunnopessoa
Member
 
Registered: Nov 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora
Posts: 67

Rep: Reputation: 15
Did you search developerWorks?

http://www-106.ibm.com/developerwork...ry/l-bash.html

I'm sure this will help you. Check parts 2 and 3... I think your answer is there.

Last edited by brunnopessoa; 10-18-2004 at 12:58 AM.
 
  


Reply



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
new to scripting mifan Linux - Newbie 2 08-17-2005 12:10 PM
another help with scripting?! ice99 Programming 2 08-09-2005 08:56 AM
Need help scripting Tamara Programming 7 06-06-2005 02:06 AM
scripting bforest Linux - Newbie 4 05-11-2004 02:45 AM
scripting anjiie Linux - Newbie 1 02-16-2004 08:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:48 PM.

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
Open Source Consulting | Domain Registration