1
管道命令我做了一些JSON解析在bash腳本:執行復雜的AppleScript中
curl http://myurl.com/get.json | sed -e 's/[{}]/''/g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | grep '"key":' | sed 's/:/ /1' | awk -F" " '{ print $2 }' | tr -d "\""
現在我想借此來的AppleScript,但我與逃逸有點困惑。 當我escpape所有"
所以我得到這樣的:
do shell script "curl http://myurl.com/get.json | sed -e 's/[{}]/''/g' | awk -v k=\"text\" '{n=split($0,a,\",\"); for (i=1; i<=n; i++) print a[i]}' | grep '\"key\":' | sed 's/:/ /1' | awk -F\" \" '{ print $2 }' | tr -d \"\"\""
它返回一個錯誤:
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file
我真的很感激這裏一些幫助!謝謝!