• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing ampersands through a shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing ampersands through a shell script


  • Subject: Re: Passing ampersands through a shell script
  • From: LuKreme <email@hidden>
  • Date: Sun, 25 Oct 2009 02:54:59 -0600


On 24-Oct-2009, at 19:34, hd wrote:
set twitter_status to quoted form of ("status=" & tweet)
display dialog twitter_status
set results to do shell script "curl -u twittername:twitterpassword" & " --data-binary " & twitter_status & " http://twitter.com/statuses/update.json";

If there's an ampersand (as in Kraak & Smaak) then the output is posted to twitter, but the tweet ends just before the ampersand. Other non-alphanumeric characters (",' etc) appear to be passed correctly.


this worked:

property twittername : "myid"
property twitterpassword : "mypas<uT&u48#JG"

tell application "iTunes"
	set thisTrack to current track
	set trackName to thisTrack's name
	set trackArtist to thisTrack's artist
end tell

set tweet to "is listening to " & trackName & " by " & trackArtist
set curlIt to "curl -u \"" & twittername & ":" & twitterpassword & "\""

set results to do shell script curlIt & " --data-urlencode \"status=" & tweet & "\" http://twitter.com/statuses/update.json";


(note the biggest change is using --data-urlencode, but I also made sure to quote-escape everything.)



-- Hudd: 'I've just done this radio show where I never met any of the other actors and I didn't understand what any of it was about' Moore: 'Ah, yes I expect that's the thing I'm in.'

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Passing ampersands through a shell script
      • From: hd <email@hidden>
References: 
 >Passing ampersands through a shell script (From: hd <email@hidden>)

  • Prev by Date: Re: LS command returns hidden files on OS X Leopard server
  • Next by Date: Re: Passing ampersands through a shell script
  • Previous by thread: Passing ampersands through a shell script
  • Next by thread: Re: Passing ampersands through a shell script
  • Index(es):
    • Date
    • Thread