Need ideas for practice exercises in sh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need ideas for practice exercises in sh
# 1  
Old 01-13-2010
Need ideas for practice exercises in sh

I did an assignment for sh scripting back in november, and I found it quite fun learning. I would like to retain this knowledge as I'm pretty sure it was my only scripting assignment, from now on in my programming course we won't be doing any scripting apart from the typical makefile scripts. The assignment was for the user to have a operations file with a list of commands for a supermarket. It wasn't very complicated but some typical commands were:
add new record, delete, modify, display all products, search for a product.
products were displayed in a format of :
isle number (5 width right justified)| brand (30 width left justified)| product(30 width left justified)

Program was to make use of command line arguments, and take a operations file as input and a database file as output, it was to parse up to any number of arguments and display typical errors and usage information, if no database file was specified then one was created in a typical directory structure:
prog
| |
data code

I was wondering if anyone has any ideas for an project around this kind of skill level or a little harder that I might be able to attempt. Thanks for your help Smilie
Edit: and would like it in bourne sh/bash format ( or doable in sh ), as I'm not familiar with other types of scripting yet.

Last edited by gcampton; 01-13-2010 at 03:14 AM..
# 2  
Old 01-14-2010
100 view and not a single idea Smilie, Bump!
# 3  
Old 01-15-2010
Quote:
Originally Posted by gcampton
It wasn't very complicated but some typical commands were:
add new record, delete, modify, display all products, search for a product.
products were displayed in a format of :
isle number (5 width right justified)| brand (30 width left justified)| product(30 width left justified)
I would suggest you to select Perl for these kind of requirements.
# 4  
Old 01-15-2010
Why not look through the posts here and pick out ones you find of interest and see if you can write your own solutions. Then you can compare them to other solutions posted and see how you are doing
# 5  
Old 01-15-2010
Quote:
Originally Posted by thegeek
I would suggest you to select Perl for these kind of requirements.

why? bourne shell accomplishes this easily. It was the assignment I did back in November. printf for field widths, functions for each task typically using grep. Test for all command line args, and a while loop to process the file.
# 6  
Old 01-15-2010
Please refrain from bumping up posts - this is not allowed here.

If you need something more complex than a supermarket you could take something from the real world that is more complex than a supermarket - maybe simulate a complex thing from nature.
Or something technical: Try to write a job scheduler that offers different reports etc., parallel processing etc. that offers remote job handling by simulating whatever.
# 7  
Old 01-15-2010
Why not take your supermarket application, and try to optimize it. Use 'timex' to measure your improvements.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with a question in one of my exercises

Hello, so I'm taking unix in one of my classes and I've been having fun, but I got stuck at this one question that I'm supposed to know how to answer but I can't wrap my head around it, I figured I'll post it here and see if someone can shed some light into what I'm doing wrong. Here's the... (1 Reply)
Discussion started by: hiwolf25
1 Replies

2. Shell Programming and Scripting

Help me get some ideas

Hello, I have been given a scripting project, but have not learned any scripting. I need to get some ideas on how to start. Attached is part of the project: I have no idea how to parse the arguments. What I had in mind was to get the arguments ($1, $2, ... ) and have if statements for different... (1 Reply)
Discussion started by: facepalm
1 Replies

3. Shell Programming and Scripting

I would like to have some exercises to develop my skills

Hi , I would like to do some exercises/scripts in order to develop my skills in shell scripts, can someone pass me some links/suggestions where i can find this? Thanks a lot :) (3 Replies)
Discussion started by: prpkrk
3 Replies

4. UNIX and Linux Applications

Need ideas for graduation project based on unix or linux Need ideas for graduation project based on

Dear all, i am in last year of electronics department in engineering faculty i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux " i think about embedded unix for example or device drivers please i need helps (1 Reply)
Discussion started by: MOHA-1
1 Replies

5. OS X (Apple)

Text stream K&R exercises

Hello, ladies, gentlemen. First I suppose I should introduce myself. I've been poking at C since a long time ago, somewhere around 1990. (Don't misinterpret that. "Poking at C", in this statement, means that I jumped on it, studied it for anything from a day to a weekend to a finished "Hello,... (21 Replies)
Discussion started by: Jammer Six
21 Replies

6. Shell Programming and Scripting

best practice please

I have a data file that I tail and dump the data into a new file at midnight. To work I had to use tail -n2 livefile.csv >> storefile.csv. This is ging me 2 or 3 entries at a time into the storefile.csv. if I continue this then I will have to run a second pass on the file to remove the... (4 Replies)
Discussion started by: Mikey
4 Replies

7. Shell Programming and Scripting

Shall Scripts exercises

I have just 3 things that I really need to know the solution, please allow me to show it. any help would be nice script that backup a file. The file name to backup should be provided as input parameter, the backup file should have the same file name with the extension ".bak". If the user... (1 Reply)
Discussion started by: anything
1 Replies

8. Shell Programming and Scripting

any ideas?

i need to compare to dates/times given in the format MMDDhhmmYY. That is month, day, hour, minute, year. It is a 24 hour clock. I need to compare two dates to check that they are, say, less than 900 seconds apart. I have got to a point where it checks the time, turns the values into seconds and... (5 Replies)
Discussion started by: fwabbly
5 Replies

9. UNIX for Dummies Questions & Answers

exercises in shell

Hi, I am a beginner at shell scripting, though I have several years of Oracle programming experience. Can anyone recommend a site where I can find some exercises on shell programming. Is there anywhere I can telnet as I dont have UNIX OS on my PC? Thanks Rohit (1 Reply)
Discussion started by: rohitv
1 Replies
Login or Register to Ask a Question