Shell Scripting - use the output of a command as an argument for another
I'm trying to set up a program to read my dynamic and natted ip address on my pda, then use ez-ipupdate to update the ip of my web page.
I figured out this command to get my external ip through the nat: html2text (url of the check site) | cut -c21-35 | grep 2 This outputs my ip to the shell. I then thought i'd do html2text (url of the check site) | cut -c21-35 | grep 2 > ipaddress Now I want to run ez-ipupdate -a (the contents of the file ipaddress) I can't run a better updater client as i'm fitting the entire distro into 16MB, and I have to put my page on that too. How can I do this? Thanks, Tim |
Code:
ez-ipupdate -a $( cat ipaddress ) Code:
ez-ipupdate -a $( html2text <url of the check site> | cut -c21-35 | grep 2 ) |
Or you might prefer:
Code:
ez-ipupdate -a `html2text <url of the check site> | cut -c21-35 | grep 2` |
Thanks very much for your help - it works fine.
I actually tried rjlee's idea earlier, but it was the back tick that got me - i tried an apostrophe. Thanks, TIm |
Quote:
Quote:
|
Quote:
a terminal console to a file, as in: cp $( tty ) file-to-be-copied-to |
Also, instead of getting ip from website you could grab it straight from ifconfig with:
/sbin/ifconfig eth0 | grep "inet addr:" | awk -F: {'print $2'} | cut -d\ -f 1 |
All times are GMT -5. The time now is 06:29 PM. |