
September 15th, 2009, 10:15 PM
|
|
|
|
Simple shell script variable question
I want to run a cron job that calls an sh script which will run wget to a webpage. This webpage will respond with $_SERVER['REMOTE_ADD'] which is the php variable that will show what IP is accessing the website.
I then want to take this IP address and make it a variable for the rest of my sh script... example...
#!/bin/sh
currentIP=[response from wget http://site.com/yourip.php]
echo This is the ip address $currentIP
exit 0
what can I put in place of [response from wget http://site.com/yourip.php]?
I have tried simply currentIP=wget http://site.com/yourip.php but that does not work.
I DO NOT want to grab the IP from ifconfig for reasons that my project will not allow and secondly... because I want to know how to do it this way. I don't want to pass it as a variable to the script either... I really want to learn how to do it with sh. Forgive me if I am stubborn, but hey, I have to learn somehow.
Thanks
gbrent
|