我正在尝试使用以下代码运行带有NSTask的shell脚本:
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/Users/username/connect.sh"];
[task launch];
Run Code Online (Sandbox Code Playgroud)
但我得到An uncaught exception was raised和Couldn't posix_spawn: error 8
如果我只是在终端中运行脚本,一切正常.
以下是脚本包含的内容:
if [ ! -d ~/Remote/username/projects ]
then
sshfs -C -p 22 user@remotecomputer.com:/home/username ~/Remote/username
fi
Run Code Online (Sandbox Code Playgroud) 如果字符串中的任何地方有一个或多个字母,则将是真的正则表达式。
例如:
1222a3999 会是真的
a222aZaa 会是真的
aaaAaaaa 会是真的
但:
1111112())-- 会是错误的
我想:^[a-zA-Z]+$和[a-zA-Z]+,但没有工作的时候有字符串中的任何数字和其他字符。
class f2011fq1d
{
unsafe public static void Main()
{
int a = 2;
int b = 4;
int* p;
int* q;
int[] ia = { 11, 12, 13 };
p = &a; q = &b;
Console.WriteLine(*p + a);
Console.WriteLine(*q / *p);
Console.WriteLine(*&a + *&b * 2);
*p = a + *q;
Console.WriteLine(a + *q);
fixed (int* r = ia)
{
Console.WriteLine(*r + 3);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在这段代码中,我对一些语法感到困惑.例如,做什么int* p,p = &a做什么?最后一部分fixed (int* r = ia),那是做什么的? …
例如,如果我有#define example(__thing__) [__thing__ doSomeStuff].
稍后在代码中,我编写example(a)的编译器将其视为[a doSomeStuff].
但是,有没有办法在源代码中替换它以进行调试?我希望每次出现都example(a)被替换[a doSomeStuff].由于实际定义的东西要长得多,所以如果我能看到实际的代码是什么就会更容易调试.