Does any one know how to execute below cmd through shell scri开发者_JS百科pt?
#!/bin/sh
USERNAME="XYZ"
defaultCmd=`defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions "{ \"USERNAME\" = \"${USERNAME}\" ;}" `
where write com.apple.Xcode
is a .plist file. The above command works perfectly on terminal.
@shelter was right - the above command run without '...' and should not be captured any value in the script. But one thing need to be noted that script should not run as "root" user otherwise this command would have no effect.
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions "{ \"USERNAME\" = \"${USERNAME}\" ;}"
精彩评论