LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 01: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, 02:17 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

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

Evo2.
 
Old 11-15-2009, 04:36 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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



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 01:25 PM
grub "chainloader +1" loops to grub menu emuub Linux - Software 1 07-15-2007 05:10 PM
PERL: Help w/ "foreach" loops and building a Crontab entry - Just need some advice bpmee Programming 5 10-13-2006 02:12 PM
aria 1.0.0 :: "make" loops eclaw Linux - Desktop 0 08-15-2006 01:33 PM
"Mail loops back to myself" - Error liquidcool Linux - General 0 10-15-2004 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:32 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
Open Source Consulting | Domain Registration