Does anyone know of any tool which can convert shell script '.sh' into a C file '.c' ?
+1
A:
I doubt that any such tool exists. C and shell files are extremely different languages with completely different purposes, and there is no way to automatically convert one to the other.
JSBangs
2010-07-29 19:55:53
Just make a shell implementation in a single .c file with `const char scripttext[] = "` at the end, and the tool is called `( cat shell.c "$1" ; echo '";' )>out.c`.
R..
2010-07-29 20:04:56
Thanks for the help but not getting what you want to convey. Can you please explain a little?
hari
2010-07-29 20:12:14
I mean find (or write) an implementation of the shell, and then embed your shell script as a constant string for the shell to run.
R..
2010-07-29 20:21:17
A:
you can try shc. Its not a compiler, but it does generate .c files during encoding/encrypting.
Otherwise, do it by hand. Learn to code in C and shell, then translate them yourself. that's the best way to do it.
ghostdog74
2010-07-30 00:45:14