I'm trying to run a shell script with NSTask with the following code:
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/Users/username/connect.sh"];
[task launch];
But I get An uncaught exception was raised
and Couldn't posix_spawn: error 8
If I just run the script in terminal, everything works.
Here is what the script contains:
if [ ! -d ~/Remote/username/projects ]
then
sshfs -C -p 22 [email protected]:/home/username ~/Remote/username
fi
You can also add #!/bin/bash
to the start of your script:
#!/bin/bash
if [ ! -d ~/Remote/username/projects ]
then
sshfs -C -p 22 [email protected]:/home/username ~/Remote/username
fi