Project Detail

Bash Shell Script  

Bash Shell Script is project number 372734
posted at Freelancer.com. Click here to post your own project.

 

| More Free Trial For New Buyers
 

Status:

Selected Providers: jeeves82

Budget: $30-250

Created: 01/19/2009 at 11:55 EST

Bid Count: 3

Average Bid:
N/A

01/20/2009 at 11:55 EST

Project Creator: SunShadow
Employer Rating: 10/1010/1010/1010/1010/1010/1010/1010/1010/1010/10 (23 reviews)

Bid On This Project
 

Description

I want to have four functions written in bash shell scripting

Function-1 (insert_record)
It will take four variables:
$name , which is will passed as an argument to the function.
The function may receive the name in one word as for example “smith” or two words or more like “Joy Smith Macline” in this case the function should replace the space with ‘_’ so it would be like $name=”Joy_Smith_Macline”
$Phone, which is will passed as an argument to the function, example $phone=”00123456789”.
$start_date, which the current date on the server but in the following format (hh:mm:dd:mm:yy).
$end_date, it would be a fixed variable which has a fix value ‘0’.
These values will be inserted into a file called “worklogs”
Sample file of worklogs:
Joy_Smith_Macline 00123456789 11:23:18:09 0
But if there is a record with same phone number and end_date=’0’, then it should break with error message, and if the record with the same number but end_date=(hh:mm:dd:mm:yy), then you can add the record.

Function2-Read _file
It will read worklog, and it will print only the records that has the value for $end_date as ‘0’ but also when it will show Joy_Smith_Macline as Joy Smith Macline that mean it will return the space in between words (on the screen only but in the file you should keep it as it, Joy_Smith_Macline).
So the output after calling this function on the screen:
Joy Smith Macline 00123456789 11:23:18:09 0

Function3-Update_file
For this function you have to pass the phone number $phone as an argument .
Then the function has to open the file and search for the line that has the same phone number but with date_end=0, once it find it will replace it with current date and time (hh:mm:dd:mm:yy), notice that there might be more than one record with the same number, if the date_end=0 update it to the current date and ignore the one with end_date is define in the format (hh:mm:dd:mm:yy).

So as a summary if ($phone =001234567&end_date=’0’) then update
Else print error message.

Function4-Check_record
You will pass the $phone as argument and you will check in the file if there is any record in the file with the same number and end_date=0 , if it’s there return 1 other wise return 0.


I want these functions to be ready within 12 hour and My budget for this task is 50$

Messages Posted:0 View project clarification board Post message on project clarification board

Bid On This Project
 

If you are the project creator or one of the bidders Log In for more options

Bids are hidden by the project creator. Log in as the project creator or as one of the bidders to view bids. You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


    Bid on this Project