curl-users
Extreme newbie question re: uploading from stdin fails to deliver expected content
Date: Sat, 21 Feb 2004 17:19:21 +0000
Dear All,
here is the problem .. I am trying to write a little command
line so that my computer at home will find out what the IP of the
router is at regular intervals and will forward that information to a
central site where I can access it. The idea is that I can always
know what address to use to be able to access my home computer from
work, or wherever I happen to be.
The command string I have is:
curl -s whatismyip.com | grep "Your IP is" | curl -T - -u <user:pwd>
http://idisk.mac.com/pjtravers/Documents/myIP.html
The first curl command gets a web page containing the IP address I
appear to be coming from.
The grep extracts the line containing that information
The second curl is supposed to write that line into a remote web page.
the commands work up to the grep .. which outputs eg
<h1>Your IP is 194.203.157.2 <br></h1>
The second curl command works insofar as it creates the output file,
but the file is empty ..ie the output from the grep command does not
appear in the new file. As I understand it, the "-T -" switch should
tell curl to take it's input from stdin, ie, from the output of the
grep command. Or have I missed something somewhere?
The output from the command is:
% Total % Received % Xferd Average Speed Time Curr.
Dload Upload Total Current Left Speed
100 40 0 0 0 40 0 87 --:--:-- 0:00:00 --:--:-- 0
There's probably an embarrassingly simple explanation for this
behaviour, but it's beyond my limited knowledge. Can anyone help?
Paul T
-- Dr Paul J Travers Deputy Director Anthony Nolan Research Institute Tel: +44(0)207284 8311 The Royal Free Hospital Fax: +44(0)207284 8331 Pond Street London NW3 2QGReceived on 2004-02-21