Phone Shell Script !?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Phone Shell Script !?
# 1  
Old 02-03-2008
Phone Shell Script !?

could you please find a solution for this

script (called phone) that creates a simple telephone list (create an empty file called “phonlist” in home directory) . Each line in this file consist of two fields name and the phone number, the script should do the following:
When user types the command : “phone new <name> <number>” this will add new record (name,number) to the list.
When user type command: “phone <name>” then the script should search in the file “phonelist” and gets the phone number and display the result.
# 2  
Old 02-03-2008
Just a principle:
Code:
#! /bin/sh

if [ "$#" -eq 0 ]
then
        exit 1;
fi

if [ "${1}" = "new" ]
then
        echo "${2} ${3}" >> file

else
        cat file | grep "${1}";
fi



exit 0

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

2. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

3. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

4. UNIX for Dummies Questions & Answers

Connecting a phone

I have an LG VX9800 (The V), am using Linux Mint, and just downloaded BitPim. The problem: BitPim doesn't detect my phone. Then again, the computer doesn't even do that. I read here (under Reference > USB > Linux USB Setup) about direct USB access, but Linux Mint apparently doesn't use hotplug. Or... (0 Replies)
Discussion started by: Zucriy Amsuna
0 Replies

5. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

6. Shell Programming and Scripting

Perl script :- Phone number validation

Hi All, I am doing a perl script validation for Phone numbers. The normal phone number format is 01-32145. I need to do two validations for the phone number 1) A valid phone number can have at least two digits as prefix and at least five digits as postfix. e.g. 01-01011 2) A... (5 Replies)
Discussion started by: subin_bala
5 Replies

7. Shell Programming and Scripting

to create a phone book using shell script and unix commands

can you help me to create a phone book with add, delete, modify with first name, last name, middle name, phone no(multiple ph no), address, email address, notes or comments to store about the contact and groups that hold for the contact.. i am new to this linux environment. please guide me. ... (1 Reply)
Discussion started by: monster11209
1 Replies

8. Shell Programming and Scripting

Help me to create a phone book using shell script

Hi guys... can any one help me out with creating a phone book: CP5290 Assignment: Phonebook Due 4 pm Friday 25th September 2009 Weight: 15% You are to implement a Phonebook using Shell scripting and UNIX command line utilities and commands. Some documentation will also be... (1 Reply)
Discussion started by: monster11209
1 Replies

9. Shell Programming and Scripting

major help needed phone dir script need advancing

dam i stuck i am trying to write a script that is a basic phone book so i can enter a name or number or both into the scripts and by using positional paramiters the script will check if the name has a number in it and warn that numbers are not allowed with names, if i enter a number then... (6 Replies)
Discussion started by: zappedback
6 Replies
Login or Register to Ask a Question