从Xcode断点运行shell命令

时间:2021-04-20 20:44:07

I'm trying to run a shell script from a breakpoint in Xcode 4.5 DP 3. I set the breakpoint as such using the Choose button.

我正在尝试从Xcode 4.5 DP 3中的断点运行shell脚本。我使用“选择”按钮设置断点。

从Xcode断点运行shell命令

However, upon hitting the breakpoint I get the following message:

但是,在遇到断点时,我收到以下消息:

Error in shell command for breakpoint "(selector name)". The command "/Users/Max/Developer/saveToLog.sh" does not exist.

I've tried to put regular shell commands, like "say test" but Xcode prints the same message (with a different command name, of course). The shell script works fine when I run it from terminal.

我试图放置常规shell命令,比如“说测试”,但Xcode打印相同的消息(当然,使用不同的命令名称)。当我从终端运行它时,shell脚本工作正常。

1 个解决方案

#1


4  

Ok, first check to make sure you have the shell permissions set correctly. In terminal type:

好的,首先检查以确保正确设置了shell权限。在终端类型:

chmod u+x saveToLog.sh

And I would also locate the shell script inside the project folder (didn't seem to work correctly for me when the script was located on my desktop).

我还会在项目文件夹中找到shell脚本(当脚本位于我的桌面上时,我似乎无法正常工作)。

This is the script I tested on:

这是我测试的脚本:

#!/bin/bash 
touch ~/Desktop/ItWorks.txt 
echo "This actually works!" > ~/Desktop/ItWorks.txt

#1


4  

Ok, first check to make sure you have the shell permissions set correctly. In terminal type:

好的,首先检查以确保正确设置了shell权限。在终端类型:

chmod u+x saveToLog.sh

And I would also locate the shell script inside the project folder (didn't seem to work correctly for me when the script was located on my desktop).

我还会在项目文件夹中找到shell脚本(当脚本位于我的桌面上时,我似乎无法正常工作)。

This is the script I tested on:

这是我测试的脚本:

#!/bin/bash 
touch ~/Desktop/ItWorks.txt 
echo "This actually works!" > ~/Desktop/ItWorks.txt