compile the entire bash shell into my app

2020-08-01 07:01发布

问题:

I want to know how i compile the entire bash shell into my app.I read somewhere that for this i compile its Subroutine. how?

Thanks in advance

回答1:

Why do you need an embedded bash?

Without more details, I would say that Lua is a more appropriate approach for scripting in an application.

EDIT:

Assuming from your other questions that your target device is an iPhone, you may be interested in reading this question: iPhone - is it possible to make system call. In short, you cannot use system() on iPhone.

After digging the subject with Google, I found that not only system() is unavailable but also exec() and NSTask class. I suspect that popen() is unavailable as well.



回答2:

A comment to mouviciel's answer implies you believe you can gain the ability to execute arbitrary Unix commands, by embedding bash. This is not correct.

Bash is a shell, i.e. an interactive environment allowing a user to enter commands, and have them run. It adds lots of functionality, programmability, and tons of features, but at its core it's still basically just reading input, and then executing commands.