tell application "Finder"
set the CBD to (the clipboard as string)
end tell

set curlCMD to ¬
"curl --stderr /dev/null \"http://tinyurl.com/create.php?url=" & CBD & "\""

-- grep for tinyurl value
set grepCMD to "| grep 'tinyurl value='"

-- use awk to pull the url out of the retuned page, using " as a delimiter
set awkCMD to "| awk -F'\"' '{ print $2 }'"

-- build the command
set shellCMD to curlCMD & grepCMD & awkCMD

-- run the script and get the result
do shell script shellCMD
set tinyURL to the result

return tinyURL