I have one shell script like this,
#Script name : test.sh
mkdir /boot
mount -t vfat /dev/block/mmcblk0p1 /boot
cp file1 /boot
umount /boot
mkdir -p /test1/test2/test3
cp file2 /test1/test2
cp file3 /test1/test2/test3
STATUS=TRUE
Now this script is located in /test/ directory. I am calling this script from a c function which is called from android application via jni. I am using this function to call my script in C
void Java_com_ndkdemo_NDKdemoActivity_systemcall(JNIEnv * env, jobject obj) {
fp = popen(". /test/./test.sh; echo STATUS=$STATUS","r");
while (fgets(buffer, sizeof (buffer), fp) != 0)
{
LOGD("%s",buffer);
}
}
Now when ever i call this systemcall function from my activity, it is not able to execute the commands inside the script test.sh The same script is working if i am compiling a binary from normal C source code and execute that binary on console. I have tried to give permission with "chmod 777 /test/test.sh" but still it's not working.
Any help will be appreciated. Thank you.