#1  
Old 4th February 2008, 16:02
anything anything is offline
Junior Member
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Phone Shell Script ?

guys I truly need the solution of this, with some explanation !

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.

and what does these commands do:

[[ -z $user ]]

--

grep

--
-eq 1 0
--

[[ `grep -c $user` -eq 1 ]]

--

thanks
Reply With Quote
Sponsored Links
  #2  
Old 5th February 2008, 17:25
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

I don't have a solution ready for you, but you can read through this guide: http://tldp.org/LDP/abs/html/

Afterwards you'll be a bash scripting genius.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 5th February 2008, 19:49
anything anything is offline
Junior Member
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you, but I really need a solution for that script, I must read and learn to do my tasks but I am a bignner on it and dont have time, so please forgive me
Reply With Quote
  #4  
Old 5th February 2008, 20:25
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 152 Times in 149 Posts
Default

Quote:
Originally Posted by anything
and what does these commands do:

[[ -z $user ]]

--

grep

--
-eq 1 0
--

[[ `grep -c $user` -eq 1 ]]

--

thanks
The first tests if $user veriable is empty,

The second is invalid

The third tests if the number of characters in $user variable has more one character.

And finally i will write you a quick script when i have some time on my hands
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #5  
Old 6th February 2008, 22:33
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,126
Thanks: 4
Thanked 43 Times in 40 Posts
 
Default

http://www.linuxcommand.org --> great site to start bash scripting...
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script backup a file HELP anything Programming/Scripts 4 5th February 2008 18:09
shell script, create bulk account webelo Programming/Scripts 1 16th January 2008 11:59
Need help getting started simple simple shell script dhonnoll78 Programming/Scripts 1 18th December 2007 12:05
need urgent help for writing shell script dips Programming/Scripts 8 3rd September 2006 19:40
Shell Script Need Help mphayesuk Programming/Scripts 4 27th June 2006 12:06


All times are GMT +2. The time now is 10:14.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.