LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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
  Search this Thread
Old 11-15-2009, 02:34 AM   #1
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Rep: Reputation: 15
“for loops" instance problem


#!/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
 
Old 11-15-2009, 03:17 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
There is a typo in the second last line $ADDERSS -> $ADDRESS

Evo2.
 
Old 11-15-2009, 05:36 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:30 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration