LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Thread Tools
Old 11-15-2009, 02:34 AM   #1
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 45
Thanked: 0
“for loops" instance problem


[Log in to get rid of this advertisement]
#!/bin/bash
# This script is for RH033 on page 128 for "for loops" instance.
for NAME in houjun19830610
do
ADDRESS="$NAME@126.com"
MESSAGE='Projects are due today'
echo $MESSAGE | mail -s Reminder $ADDERSS
done

[root@localhost ~]# ./for_128.sh
You must specify direct recipients with -s, -c, or -b.

How can I solve the problem?

Thanks.

;p
windows_98_nt_2000 jcky is offline     Reply With Quote
Old 11-15-2009, 03:17 AM   #2
evo2
Member
 
Registered: Jan 2009
Location: Japan
Distribution: Debian
Posts: 219
Thanked: 28
There is a typo in the second last line $ADDERSS -> $ADDRESS

Evo2.
linuxdebian evo2 is offline     Reply With Quote


Old 11-15-2009, 05:36 AM   #3
David the H.
Senior Member
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian Sid/kde3.5
Posts: 2,464
Thanked: 130
Code:
You must specify direct recipients with -s, -c, or -b.
This is obviously an error message from mail and not the script itself, since your script doesn't use flags. So check your mail command. Of course evo2 has already pointed out the error above.

You can also run your script with "#!/bin/bash -x" to get a verbal output of all the substitutions it's doing. This should clearly point out your variable typo.
linuxdebian David the H. is offline     Reply With Quote



Reply

Bookmarks


Thread Tools

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
LILO Diskette Loops Back on iIself when "Linux" Selected alwhitener Slackware - Installation 3 04-29-2008 02:25 PM
grub "chainloader +1" loops to grub menu emuub Linux - Software 1 07-15-2007 06:10 PM
PERL: Help w/ "foreach" loops and building a Crontab entry - Just need some advice bpmee Programming 5 10-13-2006 03:12 PM
aria 1.0.0 :: "make" loops eclaw Linux - Desktop 0 08-15-2006 02:33 PM
"Mail loops back to myself" - Error liquidcool Linux - General 0 10-15-2004 07:02 PM


All times are GMT -5. The time now is 12:51 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration