问题
I created a custom behavior in Xcode 4 (Xcode > behaviors > edit behaviors > +) in order to launch a shell script (which is configured to be executable). I can invoke the behavior using the menu or my custom shortcut (console shows up as specified), but the script is not executed (no output in the console). The script has been already tested in the terminal and it works fine! and I also created a dummy script with a simple echo and the result is the same... why? How can I debug this?
EDIT:
After solving the problem I realized what I had in mind, if you are interested read my post: Generate beautiful code documentation with a simple shortcut using AppleDoc, Xcode custom behaviors and AppleScript!
回答1:
Your script probably is running, but the output of such scripts is not piped to the debugger console. The output should be visible in the Console application (/Applications/Utilities/Console) as in the following example:
As for debugging this kind of thing, you can add the following line at the top of your script to send all output to a log file:
exec &>/path/to/logfile
You could then add something like this at the end of your script to allow you to peruse the log:
open -a TextEdit /path/to/logfile
来源:https://stackoverflow.com/questions/8400756/xcode-4-custom-behavior-does-not-execute-my-sh-script