• 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
Passing ampersands through a shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing ampersands through a shell script


  • Subject: Passing ampersands through a shell script
  • From: hd <email@hidden>
  • Date: Sun, 25 Oct 2009 01:34:34 +0000

Forgive me if this has been covered before, but…

I am passing the name and artist of the current iTunes track to a shell script (which tweets it). The script below works fine, except if there's an ampersand in the track title or artist name.


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 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.


Any ideas?

Thanks!

HD _______________________________________________
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: LuKreme <email@hidden>
  • Prev by Date: Re: Ascii number of return inconsistency
  • Next by Date: Re: LS command returns hidden files on OS X Leopard server
  • Previous by thread: Re: Ascii number of return inconsistency
  • Next by thread: Re: Passing ampersands through a shell script
  • Index(es):
    • Date
    • Thread