LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-03-2004, 05:37 AM   #1
Joey^s
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Rep: Reputation: 0
Shell script, validating email and website


in shell script, how would i check if entered email and website is valid?

please help
 
Old 12-03-2004, 06:55 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
What do you call a valid email ?
 
Old 12-03-2004, 09:30 AM   #3
Joey^s
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Original Poster
Rep: Reputation: 0
I would call a valid email

([a-z][A-Z][0-9]) @ ([a-z][A-Z][0-9]) . ([a-z][A-Z][0-9])

I have this code:
Code:
loop_enter_valid_email=1
while test $loop_enter_valid_email = 1
do
        echo "Enter email: "
        read email

        if test $email = valid **************************
        then
                loop_enter_valid_email=0
        else
                echo "Email is invalid"
        fi
done

It is the line, marked with the stars*******

that I dont have


If someone would be so helpful, to give me a line that would fit in there, I would be very happy

and similar code to check if website is valid


Thanks

Last edited by Joey^s; 12-03-2004 at 10:02 AM.
 
Old 12-04-2004, 03:49 AM   #4
Joey^s
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Could anyone help me with this?

I'd be willing to help in return if someone got this working for me
 
Old 12-04-2004, 11:21 AM   #5
dustu76
Member
 
Registered: Sep 2004
Distribution: OpenSuSe
Posts: 153

Rep: Reputation: 30
Are you telling that you are aware of regex syntax but you dont know of grep?
 
Old 12-04-2004, 05:31 PM   #6
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
Code:
read email

if echo "${email}" | grep '^[a-zA-Z0-9]*@[a-zA-Z0-9]*\.[a-zA-Z0-9]*$' >/dev/null; then
    echo good
else
    echo bad
fi
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Grep Syslog - email shell script voodoofxz Linux - Newbie 1 09-06-2005 04:27 PM
Shell script for website updating Cron Programming 2 03-06-2005 08:52 AM
write a shell script to send email yenonn Programming 4 02-11-2005 10:06 PM
Email headers in shell script anjaan Programming 3 07-07-2004 01:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration