[Android] Script to move files
Hi all, I'm trying to create a simple script that will move files around on my Nexus 7. It is stock Android 4.2.2. What I have done is I have tried to create a test.sh script with the following contents:
#!/system/bin/sh
su
cp -r /folder/* /mnt/sdcard/dcim/camera
Upon trying to run this script from the command line using sh ./test.sh, I get the following errors:
: not foundsh[2]:
: not foundsh[3]: su
cp: /folder/*: Permission denied
I have placed test.sh at the root folder of my Nexus 7 and there is definitely a /system/bin folder that has sh inside of it. The cp command also works properly after su is entered, so the problem is definitely getting the script to run correctly. Can anyone help me troubleshoot what may be the issue?
A couple of points to clarify:
- Yes, my device is rooted.
- These commands run properly when entered individually through the terminal. They do not work as a script, which is what I would like to fix.
Posted Apr 13, 2013, 10:02 PM UTC
824