Need help with UNIX script variables

I have a UNIX shell script,  with these two vairables

They represent two email adresses; I want to send an email form my script using the two variables. This is my code.

echo "${WARNING_MSG} ${RESULT_MSG}" | mailx -s "$SCRIPT error on $SERVER_NAME" "${CONTROL_TEXT_1} ,  ${IT_LIST}"

I can't get it to send to either of the email adresses. Can someone tell me if my coding (using the quotes) is correct? Remeber.. this is sendign email adresses and I want to send to two persons
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You quotes are correct.

See what happens when you add the -v flag to mailx.  This will output debug output.
joekeriAuthor Commented:
Can i use -v along with the -s   at the same time?
Yes, just do

echo "${WARNING_MSG} ${RESULT_MSG}" | mailx -vs "$SCRIPT error on $SERVER_NAME" "${CONTROL_TEXT_1} ,  ${IT_LIST}"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

here is "mailing" script I wrote 4 years ago:

although it is perl and not shell, I can tell you that for perl you can put "- , @" in the subject
for shell I know that "," is forbidden in the subject (or more problematic)


#!/usr/local/bin/perltk -w
print "\n\n### Script by Tal Mashraky - $PROJECT Project ###\n\n";
$dul_str = "ls -lR /dumps/$ENV{'HOST'}/*/* | sort -k 5 -nr | grep trn";
@dul = qx ( $dul_str ); # | sort -k 5 -r | grep trn");
$loc_str = "\du -sk /local_project/*/*";
@loc = qx ( $loc_str ); # | sort -k 5 -r | grep trn");
$dusk_str = "\du -sk /dumps/$ENV{'HOST'}/*/* | sort -nr";
@dusk = qx ( $dusk_str );
@du = sprintf ("command: \du -sk : units are [Kbytes] \n%s\n@dusk\n","#"x30);
print @du;
print "\n\n@dul\n\n";
$mail_list = "";
$mail = "all";
my @params = @ARGV;
foreach $param (@params) {
    if($param eq "-no_mail") {
        $mail = "only_user";
foreach $line (@dul) {
    $line =~ /.*\s+(\w+)\s*ftp/;
    if ($mail_list =~ /$1/) {
    } else {
        #$mail[$1] = $1;
        $mail_list .= $1.",";
foreach $line (@dusk) {
    $line =~ /^\s*(\d+).*\/(\w+)$/ && $1>=1000;
    ($size , $name)  = ($1 , $2);
    if ($line =~ /^\s*(\d+).*ncsim.*\.(\w+)\.\d+[A-Z][a-z]{2}/) {
        # dollar 1 override
    unless ($mail_list =~ /$2/ || $size<1000) {
        $mail_list .= $2.",";
    print "dollar 1 = $size \n";
$mail_list .= "talm";
print "mail_list= $mail_list\n\n";
if ($mail eq "only_user") {
    $mail_list = "$ENV{'USER'}";
    print "FIXED mail_list= $mail_list\n\n";
$mail_str = "\du -sk /dumps/$ENV{'HOST'}/*/* | sort -nr | mail -s \"clear dumps on /dumps/$ENV{'HOST'}/* - by scr
ipt\" $mail_list";
print "$mail_str\n";
system ($mail_str);

Open in new window

Hanno P.S.IT Consultant and Infrastructure ArchitectCommented:
Don't use
  mailx -s "$SCRIPT error on $SERVER_NAME" "${CONTROL_TEXT_1} ,  ${IT_LIST}"
rather than
  mailx -s "$SCRIPT error on $SERVER_NAME" "${CONTROL_TEXT_1}" ,"${IT_LIST}"
Hanno P.S.IT Consultant and Infrastructure ArchitectCommented:
... and what was your problem?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.