On Wed, Feb 11, 2009 at 7:32 PM, fadden <fad...@android.com> wrote: > > On Feb 11, 8:13 am, David Turner <di...@android.com> wrote: > > you can't use system() to call a shell script, you need to invoke the > shell > > interpreter instead, with something like "/system/xbin/sh > > /system/xbin/test.sh" > > I tried it just now from a trivial C program; worked fine. I'm not > sure why it would be different from inside the Android app > environment. > > it's a feature of the C library; and I don't think we have that implemented in Bionic
> > > On Wed, Feb 11, 2009 at 1:54 PM, Corey <uvic2...@gmail.com> wrote: > > > I write an API in C by using system("/system/xbin/test.sh"); funtion, > > > and then my Java code will use this c API code to execute this shell > > > script. > > > However, it seems nothing happens. > > > Can I call a shell script from JNI? > > Make sure you have the right "#!" line -- "#!/bin/sh" will not work, > since the shell doesn't live there. For example: > > #!/system/bin/sh > echo hello >> /sdcard/foo > exit 0 > > Bear in mind that stdin / stdout / stderr are redirected to /dev/null > by default, so you won't see any output. > > > > --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---