All

Here i want to run .sh file via system call in android NDK.

I able to run cp,rm command via system call. but sh command is not working
via system call.

I also installed busy-box on android.I am using below code.I set all
permission on test.sh.

Code :

#include <stdlib.h>
#include <stdio.h>
#include <android/log.h>
#include <jni.h>

#define LOG_TAG "Demo"

#define LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)


void Java_com_ndkdemo_NDKdemoActivity_systemcall(JNIEnv * env, jobject obj) {

    int result;

    result = system("cp /mnt/sdcard/test /Download");

    LOGD("result is cp %d", result);

    result = system("sh ./test.sh");

    LOGD("result of test.sh is %d", result);

}

Output :

 result is cp 0.
 result of test.sh is 0.

Here i am getting 0 in system("sh ./test.sh"); but not started the test.sh
 script.

cant get output "Hi" on console.

test.sh contains

#!/system/bin/
echo "Hi"

If i am executing direct command on prompt than its working fine and its
given output "Hi" on console.

Please Help me to figure out this issue.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to