从iPhone应用程序运行bash脚本? [英] Running BASH script from iPhone app?

查看:467
本文介绍了从iPhone应用程序运行bash脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想知道是否可以运行从iPhone应用程序控制台脚本(.SH)。剧本是写从我设置,respring,然后在设定的时间后删除该程序,然后再respring存储库下载一个程序,因此它需要root权限,并且是在交互式用户可以设置多长时间该计划将被保留。我有bash脚本编写,并从移动终端调用时它工作正常,但有什么办法从(越狱)应用程序中做到这一点(不使用移动终端/ SSH /老板preFS)?还是有一个整体更好的方式来实现这一目标?
谢谢

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

推荐答案

Jasarien就在这里是pretty只供而我们都知道,所有的应用程序都沙盒。但它不是不可能的,因为Objective-C的只是建立在C,可使用

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");

执行基本 LS 命令,如果你在你的GDB的输出看它的作品。本书虽然你也可以用popen这让流到App的数据进行工作。

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.

这篇关于从iPhone应用程序运行bash脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆