Friday, July 11, 2008

one line curl paste

Recently an utility named wgetpaste run into my field, but after coming across it, I found it was really a shell script, it just organizes arguments and transfer to wget, in use of post mode of wget,



$ head -n1 /usr/bin/wgetpaste
#!/bin/sh


In fact, I found that curl is better at this job, when I post some code to a paste service, just one curl command is enough:



$ curl -d poster=chengrq -d syntax=c --data-urlencoded content@file.c \
http://paste.ubuntu.com


And, if you would like to read from a pipe other than a file, you could use '-' to replace the filename, it always did like what you think of that!



BTW, ubuntu did a good job on the paste service, supporting many syntax highting.

No comments: