Basically I am wondering if it is possible to run a console script (.sh) from an iPhone App. The script is written to download a program from a repository that I set up, respring, then after a set time delete the program and respring again, so it needs root privileges, and is interactive in that the user can set how long the program will be kept. I have the bash script written, and it works fine when called from mobile terminal, but is there any way to do this from within a (jailbroken) app (without using mobile terminal / SSH / Bossprefs)? Or is there an overall better way to achieve this? Thanks
Since you're working with a Jailbroken phone, you're pretty much unrestricted. Whether or not there's anything in the iPhone APIs that allows for script execution is another matter though. Also anything you do use will be unsupported, and is likely to change, stop working or be removed in a software update.
Also, you probably already know this, or don't care, but you won't get past Apple's review process for the App Store if you start running BASH scripts. Interpreted code is forbidden.
I would look up how to do it on OSX, chances are that'll be how it's done on the iPhone, but you probably won't find any iPhone specific documentation about it because it's not allowed on a "normal" iphone (one that is not jailbroken)
Jasarien is right here it is pretty resticted and as we all know that all apps are sandboxed. But it is not impossible since Objective-C is just build on C you can use
System('ls');
to execute a basic ls command and it works if you look in your gdb output. Altho you can also use popen to get the streams to app to work with the data.
That is great :) Then you can declare this question as closed by pressig the V mark on the left on my answer. Have fun :)
something you may consider is using NSTask if you want to get output and error messages from the shell.