Curl 如何将AppleScript变量的值设置为shell脚本的结果';是什么要求?

Curl 如何将AppleScript变量的值设置为shell脚本的结果';是什么要求?,curl,applescript,Curl,Applescript,为什么下面的方法不起作用 set myIP to (do shell script "/usr/bin/curl icanhazip.com") log myIP 如果我从命令行运行/usr/bin/curl icanhazip.com,它将按预期返回 如何将结果设置为AppleScript变量的值?您的脚本在我的机器(OS X 9.2)上运行。出于测试目的,请尝试以下操作: set myIP to (do shell script "/usr/bin/curl icanhazip.com")

为什么下面的方法不起作用

set myIP to (do shell script "/usr/bin/curl icanhazip.com")
log myIP
如果我从命令行运行
/usr/bin/curl icanhazip.com
,它将按预期返回


如何将结果设置为AppleScript变量的值?

您的脚本在我的机器(OS X 9.2)上运行。出于测试目的,请尝试以下操作:

set myIP to (do shell script "/usr/bin/curl icanhazip.com")
display dialog myIP

从命令行运行curl,让它将结果输出到文件中。然后,在脚本的最后一行“cat thatfile”如果脚本是一行,在添加“cat thatfile”之前,在末尾添加一个分号。这很有效。为什么
log
不起作用,而
display dialog
起作用?呃,没关系。我把AppleScript编辑器放在“结果”选项卡上,而不是“事件”选项卡上。令人沮丧。我曾尝试将deviceid设置为(执行shell脚本“system|u profiler SPUSBDataType | sed-n-e'/iPad/,/Serial/p'-e'/iPhone/,/Serial/p'| grep\“Serial Number:\”“| awk-F\:\“{print$2}”),但这不知道为什么??