If you are asking specifically for Python and PHP scripts, SL4A probably is your best choice (though there are other Python
supporting apps in the playstore, like e.g. QPython Lite). And if you want to automate things, you might want to take a look at the SL4A Script Launcher (in connection with TaskBomb task scheduler) as well.
Android's shell will support a limited amount of Unix-style shell scripting. It specifically should have a shell at /system/bin/sh that you can use, however:
The shell provided with Android has a severely restricted set of commands available to it. If you want to do anything even remotely complex you'll need a busybox install (or another shell).
How about Chainfire's tool Pry-Fi which was announced over at XDA?
It works great and it is available via the official Google play-store at:
Here’s a screenshot showing the tool in action…
Well it's obviously not #2, updates would not work so well if they could not update existing items.
The script as a whole might do #1, but package_extract_* does #3. You can see the code here: https://android.googlesource.com/platform/bootable/recovery/+/7d0542f28045640dfab6a259ae7bd796e653d66f/updater/install.c
There are a few Android apps that are able to control other Android apps, and can chain several commands together using their GUI in a similar way to a script, they both have plugins to extend their support to many popular Android apps and functions.
Tasker and Locale are probably the most famous of these (see here for some comparison) but there are also ...
You want SL4A. From the website:
Scripting Layer for Android (SL4A) brings scripting languages to Android by allowing
you to edit and execute scripts and interactive interpreters directly on the Android
device. These scripts have access to many of the APIs available to full-fledged Android
applications, but with a greatly simplified interface ...
Actually you can do that by using the run_program syntax in updater-script to execute a shell script that moves/copies/pastes files while in recovery. But of course, you must extract the files that are to be pasted in somewhere (/tmp for instance).
Part of the updater-script:
set_perm(0, 0, 0755, "/tmp/stuff/...
As you write you know Unix scripting, you might want to take a look at apps like SH Script Runner, Script Manager, Script Kitty, and similar. They all allow you to run shell scripts on your Android device.
Also, you could utilize Tasker: create a task to run a script, and then create a shortcut to that task on your homescreen. So you have easy access to ...
Look to /etc/ directory. Usually it is placed in /system/ partition which you can mount as RW:
$ ls -l /etc
lrwxrwxrwx 1 root root 11 Jan 1 2009 /etc -> /system/etc
$ mount -o remount,rw /system
$ chmod o+w /system/etc # for "adb push"
Some above steps may be replaces with:
$ adb root
$ adb remount
and later remount RO:
$ chmod o-w /system/etc
It worked by just doing sh /mnt/sdcard/touch.sh & after having started a shell with adb shell. Then, when I closed the terminal forcibly while the process was in the background, the process remained running in the background of my phone as expected. I was able to kill the process later by getting with adb shell the using ps to find the process ID and ...
Is there any specific command or script to be put on the flash drive, to acquire image of Android smartphone and store the acquired image to the flash drive On-The-Go?
Nope. No special command or script is needed other than cat or dd, the binaries thankfully Android comes with.
Often, the auto mount point of a flash drive is /mnt/usbotg (may differ for ...
You can use this command:
adb shell settings get secure location_providers_allowed
returns nothing, implying the GPS is switched off.
gps,wifi,network or gps,network -- High accuracy mode
wifi,network or network only -- Battery saving mode
gps -- Device only
How much is the possibility that Android will kill my executable?
Privileged native processes usually don't get killed by Android except if they can't handle an error occurred inside, such as some system resource not available or permission denied because of SELinux etc. To free up memory, Android only kills processes within its framework i.e. running under ...
Is there a way to create an icon on the home screen that will launch one of these scripts?
There is another way (other than this one) if you happen to use Terminal Emulator for Android app. It allows a widget which can be used to execute a script.
Install that app, choose Term Shortcut widget in your current launcher.
Corresponding to Arguments enter:
One thing I haven't seen mentioned yet is SL4A, the Scripting Layer for Android. This allows you run various types of scripts on your phone, Python scripts being one of them. Since SL4A isn't directly in the Play store, you may want something like QPython instead (which incorporates SL4A). Tasker, also mentioned by Izzy, has the ability to launch SL4A ...
You could do that using e.g. Tasker, the mighty automation tool:
Condition: Monitor Start (i.e., Tasker was started; alternatively: Device Boot, i.e. boot process finished)
Task: Run Shell, with your command as parameter
If you like it more fancy, you could even use Variable Randomize to generate a different MAC each time...
Your SD card isn't prepared at the time that the bind command is executed, because the mounting process hasn't ended yet. To bind, you have to wait several seconds for the mounting of SD card & external SD to be finished.
n="$(dumpsys mount | grep -c 'external')"
until [ $n -eq 1 ]
Android apps aren't binaries. They're .apk's, similar to Java .jar files, and .dex or .odex files when in bytecode form. They're run in the Dalvik virtual machine, again very similar to a Java VM.
You can launch an app from a shell as follows:
am start -a android.intent.action.MAIN -n <package name>/<activity name>
For example, Angry Birds:
A great app for that is Automate. I've used it with great success. There are a few plugins that exist; you may or may not need them
The main app is here
Based on your use case, you may want this, this and maybe this extensions but it all depends on how you use the main app
The best one I've ever come across is Tasker. It isn't necessarily coding but you do get to script your tasks in a scratch fashion. Although I don't see how it might be different from Automate which is another great choice.
Tasks created for tasker can also be download from the internet of which Tasker Wiki is my favourite source.
Copy a file (-p preserves permissions and ownership):
run_program("/sbin/cp", "-p", "/system/framework/file-to-copy.apk", "/system/file-to-copy.apk");
Rename a file (-f forces overwriting the existing file):
run_program("/sbin/mv", "-f", "/system/file-to-copy.apk", "/system/renamed-file.apk");
For reference, the syntax for Edify scripts (that's what they'...
You will probably be unable to directly execute scripts from your sdcard. At least without root. Reason is, with most ROMs sdcards are mounted using the noexec flag -- which means, as the term suggests: "no exec from here". Of course, having root you could simply remount the sdcard while removing this option.
Why might this option be forced? I'd say for ...
You might want to take a look at ScriptManager:
Manage and execute shell scripts and programs in file system.
All executions run over vt100 terminal accepting user input and esc codes (colors, bel, cursor movement ..)
Run them at boot-up and/or on network status change possibility.
Schedule at selected time. (cron jobs)
Alternatively, Tasker can be ...
Adding extensions will solve this type of requirements.
But Chrome for android does not support any extensions yet.
Look at the Chrome for Android FAQ
Or else you can use Dolphin Browser to achieve this. It supports extensions.
If you are willing to use Dolphin Browser instead of Chrome, use this Auto Reload Extension.
You can set time intervals in it.
In addition to the other answer with Tasker ("You could do that using e.g. Tasker, the mighty automation tool:"), here a little Task (description export) with randomizing the MAC:
A1: Variable Set [ Name:%count To:0 Do Maths:On Append:Off ]
A2: Variable Randomize [ Name:%random Min:0 Max:15 ]
Matthew already pointed to tasker for this task (uh) – an app I already use for years. So let me add the steps to achieve this. Obviously, a pre-condition is the device is rooted – but the su command in the question tells me it is. So here we go:
Condition: State › Net › WiFi Connected
As parameter, include the SSID of your WiFi network, so it doesn't fire ...
Wrong syntax :)
adb shell "mount -o rw,remount /system"
would do in your case (i.e. passing the command you want to run on the device to adb shell in double-quotes; the "exit" is not needed here as it is "implied"), provided your device's ADB daemon runs in root mode. You can even run multiple commands at once this way, e.g.:
adb shell "mount -o rw,...
In your script you forgot # , and what is more the command to delete is not delete(as you wrote) but rm, along with at least one option:
-r for recursive
-f for force
-v for verbose
For a single file
For a group of files @ location by extension with wildcard:
The Reason for this failure is that Android blocked chroot for som reason. Like Death Mask Salesman pointed out, it is possible to get information about the command type via type commandName e.g. in this case type chroot.
To solve the tmp-mksh: chroot: not found-error it is only required to install BusyBox.