I used to use this:
ifconfig ppp0 | grep "inet " | sed "s/^.*addr:\([0-9.]*\) .*$/\1/" > ipaddress

This worked good, I should mention that i didnt write it... rick did, when
is comes to awk and sed... he da man :)

for filename in `ifconfig ppp0 | grep "inet " | sed "s/^.*addr:\([0-9.]*\) .*$/\1/"`;
do
        echo "<a href=http://"${filename}">"Tim's Webserver is Here"</a><br>";
        echo "<a href=telnet://"${filename}">"Telnet to Tim's  Server"</a><br>";
done;

I used the above code, and a top form, and bottom form to generate a
webpage (named webserver.shtml) then ftp'd it up to EFN using another nice
little script.


#!/bin/bash
# /usr/bin/scripts/announce
PATH=.:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/bin/scripts; export PATH

host=ftp.efn.org

hostname=`hostname`.efn.org

(
  echo "open $host"
  echo "user EFNUserName EFNPassword" # NOTE: put your password in here
  echo "cd public_html" 
  echo "lcd /usr/bin/scripts"
  echo "put webserver.shtml"
  echo "bye"
  echo "quit"
  ) | ftp -n -i -v -d 2>&1 > localtmpfile

I have(or had) all this(and more groovy stuff) in one nice script, but
err... i cant seem to find it right now :(

Jamie

On Mon, 22 May 2000, Timothy L. Bolz wrote:

> 
> I'm trying to get my ppp ip address from this script
> 
> PPP_DEV="ppp0"
> /sbin/ifconfig |grep -A $PPP_DEV\| awk '/inet/{print$2}'| sed -es/addr://
> 
> it gives me the local and the ppp0.  I wanted to use it to put my ip
> address in my page which then friends could check out my web pages on my
> system rather than efn"s.  I have appache going on my system here at home.
> I did a search on ip extracting and found very little on it.
> 
> Tim
> 

Reply via email to