#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    111
    Rep Power
    11

    bash mail script


    Hi, I have the following bash script that I want to use to send email to more than one respondent, and I keep getting an error
    "syntax error near unexpected token `mailx' "
    Can someone pls tell me what I'm doing wrong?

    #!/usr/bin/bash -f

    set $all="`cat list`"

    for x in $all;

    mailx -s "Subject Line Here" $x < mesg;

    end
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    137
    Rep Power
    0
    Change:
    mailx -s "Subject Line Here" $x < mesg;
    To:
    cat mesg | mailx -s "Subject Line Here" $x

    But this might be even faster (even works from the command line):

    cat mesg | mailx -s "Subject line" `cat list`

IMN logo majestic logo threadwatch logo seochat tools logo