shell scripts

rggvegas

New member
Is it possible to create and execute shell scripts or alike
On android using the terminal ?

I wrote a simple one using nano on the terminal
But don't know how to execute it.
I try to use chmod 700 to try and make it executable.

Am I taking the linux part of android a little to far here ?
 
Ok only chmod 700 file.sh seems to run with no problem
But when I ls -l file.sh it still does not have executable permissionss

It only runs when I use sh file.sh
 
I tried to copy my .sh from my sdcard to
System/bin couldn't do it
Also tried to create a symbolic link and
Couldn't do that either.

I tried doing all that after su.

So how do I go about coping, linking, deleting
And so on from the terminal ??
 
It should be noted that the /sdcard is mounted no-execute by default. This means that you can't directly execute things from it. However, you can execute things in the system which call it, for instance, if you have a script named "/sdcard/foo.sh" like:

#!/bin/sh
blah blah stuff..

then you can call it with the defined interpreter, in this case, "/bin/sh" -- so, you'd call this script like this:

sh /sdcard/foo.sh

and it should execute.

Shell scripts work fine under the terminal emulator, as well as via SSH to the phone. Just like any normal *nix system. Now, I just need to find some documentation on how to access the hardware from the shell..

Hope this helps someone!
--W5i2
 
Back
Top