curl-users
curl script to post to pastie.org
Date: Wed, 3 Feb 2010 17:43:10 -0800
I am stumped on this for a few days now.
I want to take the contents of my clipboard, which on Mac OS X I can get to with `pbpaste`, and send it off to pastie.org. I have an elaborate mess of an applescript to make this all happen.
My problem, I have distilled down to a simple shell script:
#!/bin/bash
THEDATA=`cat ~/Desktop/curly.txt`
curl http://pastie.caboo.se/pastes/create -H 'Expect:' -F 'paste[parser]=plaintext' -F "paste[body]=$THEDATA" -F 'paste[authorization]=burger' -s -L -o /dev/null -w '%{url_effective}'
The curl command is all one line, you can get it cleanly out of here: http://pastie.org/808664
It works a lot of the time. Right now, I have this for curly.txt:
cat ~/Desktop/curly.txt
<
So there is a literal less than symbol in the file, returning to me the value for url_effective as: http://pastie.caboo.se/pastes/create (incorrect)
When it does work, if I were to put the contents of this email into a second file...
I get back this url: http://pastie.org/808674
* Odd that I can have the < in the file, just not as a first character. Though I am wiling to bet that there are other characters, quotes, tic marks, etc, that will hang it up. I have tried encoding it, and only end up with encoded literals in the resulting pasite.
Suggestions? Thanks in advance.
-- Scott * If you contact me off list replace talklists@ with scott@ * ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-02-04