Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to execute a shell script in android shell

I am trying tun a shell script from android shell. Please see the output below.

root@user:/data # ./run_script.sh
/system/bin/sh: ./run_script.sh: No such file or directory

root@user:/data # ls -l run_script.sh
-rwxrwxrwx root     root         5861 2016-11-14 07:31 run_script.sh

Why is it saying "No such file or directory" The error is strange as the file is actually present.

I tried copying the same shell script to /system partition as well. The result is same. I verified from mount command that both the partitions are not mounted with noexec flag.

I am able to get it working with sh run_script but I want to get it working by executing directly.

like image 750
Sandeep Avatar asked Oct 16 '25 15:10

Sandeep


1 Answers

Usually this happens when a shebang is not correct. Check if you have a "#!..." at the start of the script and remove it or correct it

like image 174
Arkon-v Avatar answered Oct 18 '25 07:10

Arkon-v