views:

92

answers:

2

Here's my code:

curl -u "u:d" --data-urlencode "status=`echo $@|tr ' ' '+'|tr '&' '%26'`" "http://twitter.com/statuses/update.json"

But when it goes to twitter, the '&' turns into '%'. What am I doing wrong? Thanks!

A: 

tr performs individual character replacement.

It replaces & with % because that's what you told it to do.

You want something like sed which does more than just character-by-character substitution.

Anon.
Ah, right. Thanks!
David
A: 

sed "s/\&/\%26/g"

Adam Pierce