procmail
[Top] [All Lists]

Variable Problem..

2000-05-12 02:33:39
Hello,

If I do this at the command line, it returns my current dynamic IP:
ifconfig ppp0  \
      | awk '{ if ( /inet addr:/ ) printf("%s\n", $2); }' \
      | sed s/addr://g


However, this in my procmail rc file just sends a message with the text, but
a blank where the IP should be:


:0
* ^Envelope-to: getdynip@
* !^X-Loop:[     ]+getdynip-X0X0
{
  # Figure out address so we can tell others
  ADDR=`ifconfig ppp0  \
      | awk '{ if ( /inet addr:/ ) printf("%s\n", $2); }' \
      | sed s/addr://g`

  # Generate a reply with appropriate headers
  :0 fhw
  | formail -rtk -I"X-Loop: getdynip-X0X0" \
                 -I"Subject: Dynamic IP response: $ADDR" \
                 -I"From: user <user(_at_)domain(_dot_)com>"

  # Now replace the body (if any) with the IP Address
  :0 fbw
  | (cat - > /dev/null ; /bin/echo -e "\nMy ppp0 IPAddress is: ${ADDR}\n\n")

  # Now send it off to recipients mentioned in generated To:
  :0
  | $SENDMAIL -oi -t
}


Any ideas?



Thanks!


Bye for Now,

Ian


                                \|||/
                                (o o)
 /---------------------------ooO-(_)-Ooo---------------------------\
 |  Ian Chilton     (IRC Nick - GadgetMan)     
ian(_at_)ichilton(_dot_)co(_dot_)uk  |
 |-----------------------------------------------------------------|
 |  Backup E-Mail -->  ian(_at_)ichilton(_dot_)dhis(_dot_)org      ICQ #: 
16007717  |
 |  Mobile Phone (MAX 150 Chars!) -->  
ianchilton(_at_)sms(_dot_)genie(_dot_)co(_dot_)uk  |
 |-----------------------------------------------------------------|
 |  http://www.ianchilton.co.uk  --> Main Page                     |
 |  http://www.ichilton.co.uk    --> Own Web Server (When Online)  |
 |-----------------------------------------------------------------|
 |  "Unix is user friendly - it's just picky about it's friends."  |
 \-----------------------------------------------------------------/

<Prev in Thread] Current Thread [Next in Thread>