paranoidhominid
paranoidhominid

Reputation: 43

Is it possible to execute a shell script in an Android phone?

I have an Android 2.2.2 phone (LG P350f). It's rooted with Superuser and I have just installed Android Terminal Emulator. I log in as root (su) and try to execute a simple script, lol.sh, which is supposed to echo a string. I get the following output:

# ./lol.sh
./lol.sh: permission denied

Obviously I have tried to set permissions, but after typing:

# chmod 777 lol.sh

I still get this:

# ls -l lol.sh
----rwxxr-x ...

The file resides in the sd card, I will try to move it elsewhere, any other ideas?

Upvotes: 1

Views: 3372

Answers (2)

Diego Torres Milano
Diego Torres Milano

Reputation: 69198

From your question it seems you have root access (the # in the shell prompt), so move your script to a filesystem mounted with exec permission for example:

# mv lol.sh /data/lol.sh
# chmod 700 /data/lol.sh
# /data/lol.sh

Upvotes: 1

skorgon
skorgon

Reputation: 604

Most filesystems in Android are usually mounted with the 'noexec' option. Make sure you place your script on a filesystem which does not have that option set.

Upvotes: 2

Related Questions