944,116 Members | Top Members by Rank

Ad:
Nov 17th, 2005
0

Need Urgent Help with 2 Projects

Expand Post »
I have these two projects due tomorrow for extra credit in my Unix class and I have no idea how to write them. I really need the extra credit to bump my grade up a little. Any help would be greatly appreciated. Here are the descriptions:

Project One: A) Create a shell script called "add_listing" that prompts the user to enter a line of text and then appends it to the end of a file called "pbook"
B)Create a shell script called "find_listing" that prompts the user to enter a search string and then displays all lines from the "pbook" file that contain the entered string. The output should be stored.
C)Combine the above two scripts into a single script that will accomplish both of the above tasks depending on how it's invoked.

Project Two: A)Create a shell script that recieves the name of a directory as its argument and searches for any zero-length files within that directory. The script should display the names of these files.
B)Modify the above script to search not only the directory, but any sub-directories (and sub-sub-directories) as well.
C)Modify the above script to prompt the user for each file, asking if they wish to delete the file. The permissable responses should be 'Y', 'y', 'N' or 'n'. If 'Y' or 'y' delete the file. Otherwise, leave the file in place.

I have tried to do these over the past day or so but I haven't gotten them to work. If someone could help quick that'd be great. Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Wolfy is offline Offline
2 posts
since Nov 2005
Nov 17th, 2005
0

Re: Need Urgent Help with 2 Projects

And what exactly have you done, and where/why doesn't it work?
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Nov 18th, 2005
0

Re: Need Urgent Help with 2 Projects

Just a skeleton outline of the scripts would be helpful because I really don't know where to start besides #/bin/sh at the top...lol. I've read chapters 10 and 11 in my book but I'm still having problems. Like I said, it's extra credit, so we didn't go over how to do it in class. Please help quickly...Thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Wolfy is offline Offline
2 posts
since Nov 2005
Nov 18th, 2005
0

Re: Need Urgent Help with 2 Projects

echo "some prompt" - displays a prompt
read variablename - reads input from the terminal
echo "$variablename" >> filename - appends a line

Now you put them together.
Reputation Points: 62
Solved Threads: 10
Junior Poster
jim mcnamara is offline Offline
179 posts
since May 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Problem with ksh loop
Next Thread in Shell Scripting Forum Timeline: AWK command





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC