Questions tagged [scripts]

Scripts are small programs written for a command interpreter or another scripting language.

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
896 views

ifup/ifdown scripts

I am fiddeling with some network related things and want to try them on Android too. In Ubuntu it was quite easy to run some commands if an interface (eth0 or wlan0) goes up or down by simply adding ...
3
votes
1answer
67 views

find: multiple "-exec" for list of files not working?

I am trying to figure this out on an Android phone running Oreo / 8.0, with toybox 0.7.3-android. I am trying to get a list of files inside a folder and their respective mtime. I am running this ...
3
votes
0answers
592 views

How to run a script on USB OTG Drive?

First up - I do not have any experience at all with programming in Android or Linux environments. So, very sorry if this question sounds stupid. Here is what I am looking for: I use a USB drive in my ...
3
votes
0answers
776 views

Running your own .sh script at vold.decrypt=trigger_shutdown_framework via init.rc (android 5.0)

I want to workaround a vendor bug in an Android 5.0 phone (chinese, MTK, no proper source) Problem is due to a bug in some binary, /data is not properly released on vold.decrypt=...
3
votes
0answers
2k views

How can I change preferred network type through a script (or terminal command)

I'm currently attempting to create a workaround for a problem that is plaguing a ROM that I'm using. While my phone and ROM are capable of using LTE, and use it perfectly fine, the "preferred network ...
3
votes
0answers
1k views

Help with this ADB REVERSE Tethering Script?

I added the functionality to automatically turn on reverse tethering after many fails: Now i only enter t into terminal alias t='r && sz $tether && r && sz $n' tether='am ...
2
votes
0answers
25 views

Write a script to extract memos?

Is it possible to run a script on Android that would access the Samsung memo app, take each note in there, copy its content, send it somewhere (e.g. an email or just store in a text file) then delete ...
2
votes
0answers
1k views

Batch script use sqlite3 to edit settings.db

I want to create batch script to enable hidden languages in a Huawei phone. But every time I stuck can you guys spot where is my problem @echo off color e cd "%~dp0" mode con:cols=90 lines=40 adb ...
2
votes
1answer
68 views

Share text via HTTP request

I'd like to add an item in the system "Share" menu that sends links and other small text via HTTP POST requests. On my PC i'm using curl + a shellscript.
2
votes
1answer
6k views

How can I successfully run this script on a emulated terminal on Android?

Background I am trying to install Ubuntu onto my Acer Iconia A500 using VNC and this application called Complete Linux Installer. My tablet is rooted and I have found several sources saying they have ...
1
vote
1answer
31 views

How can I install Greasemonkey, Tampermonkey, or similar in Firefox Android?

I have Firefox 94.1.2 on a Pixel 3XL with Android 10. I'm trying to install a user-script extension like Greasemonkey Tampermonkey. addons.mozilla.org shows these are both available for Android: ...
1
vote
0answers
100 views

How to use rclone-mount with Termux:Boot?

I would like to do what is described in this post: How to mount rclone on Android? and then have Termux:Boot automatically mount my rclone remotes at boot time. As per that post, I am using the static ...
1
vote
0answers
65 views

How to automatically set a CPU governor on boot?

There are apps that can accomplish this task (e.g. "Kernel Adiutor" and others), however they in turn require other apps that can grant them root access to begin with, which is a lot of ...
1
vote
0answers
41 views

Executing Edify script via adb shell

Edify script is a very limited language that is being used in flashable zips (mostly updater-script files); Within Edify script we can execute shell commands (run_program()) but what about the vice ...
1
vote
0answers
109 views

Addon.d script on Android 11

Google introduced system_ext partition in Android 11 which can use system resources and can include system modules that: Extend AOSP system modules in the system partition. We recommend upstreaming ...
1
vote
0answers
93 views

How via "a script" to move files (pics and videos from Camera) from phone to SD card?

A user may have a slow SD card. So taking pictures and videos on internal storage solves the problem nicely. It has 100GB. However, it can get big. And the SD card is 256GB. So the user wants to free ...
1
vote
0answers
124 views

How to long-press in android 4.1.2 and 4.2.2 using ADB?

I discovered that the command below does not execute in android 4.1.2 and 4.2.2 but it executes from android 4.4+. input touchscreen swipe x1 y1 x2 y2 [duration] I am using my old android 4.1.2 and ...
1
vote
0answers
53 views

Error trying to copy gz userdata file to partition in adb shell

Dealing with limited space I split my userdata image file with this command: dd if=/dev/block/mtd/by-name/userdata | gzip -c | split -b 250m - /mnt/sdcard/userdata.gz. That works fine, but when I ...
1
vote
1answer
698 views

Adding custom bootup script to Android-x86 Nougat

I've been happy using Android-x86 Nougat on my system. Thanks to everyone who made that work. I'm now trying to make one small change which is that I want to run a custom init script (a shell script) ...
1
vote
1answer
340 views

How to enable/disable lock screen from shell script when a special wifi SSID is present?

My Java skills are low, but I'm mastering shell. Is use LineageOS 14.1 (forked from cyanogenmod). I would like to create a shell script on a rooted devive to enable/disable lockscreen (PIN). I ...
1
vote
0answers
340 views

How to set CPU frequency as early as possible?

What I mean by this question is the sequence of execution of scripts at boot time. Suppose I have this line of script: echo 307000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq I want ...
1
vote
0answers
32 views

Script to disable email signatures in default Android email app

We use Airwatch to manage our company phones, and the task was handed to me to make sure the "Sent from..." default was disabled. Is it possible to create a script that could be pushed out to turn ...
1
vote
0answers
2k views

LineageOS: run custom script (start service) at boot

Seems like a simple thing. How can I run custom script on my (rooted) android with LineageOS at boot? Neither creating it as /data/local/userinit.d/99sshd nor /data/local/userinit.sh did not help. ...
1
vote
0answers
195 views

TWRP - Redirect script stdout to recovery output

I have a flashable zip that runs a .sh script on flashing it via TWRP. What it does not do is that it doesn't print stdout of the script to the recovery output (although it logs it in /cache/...
1
vote
0answers
728 views

Is it possible to have the system/kernel reverse x-axis touch input?

I have a galaxy S6 G920F. I have this problem with my touchscreen. The x-axis input is reversed. When I touch it on the left part it registers the touch on the right etc.. Is there a way to just ...
1
vote
0answers
856 views

Mounting USB in android 4.1.2

I am trying to mount USB pen drive in my old Xperia phone running Android 4.1.2 When I connect OTG device to my phone I get an USB power consumption error. After little search I found a command to ...
1
vote
2answers
1k views

How can I detect if a shell script is running on Android?

What is the most reliable way to detect if a script is running on Android (instead of a regular Linux build)? To run scripts, I'm using bash, the Terminal app, and BusyBox.
1
vote
1answer
59 views

SHELL Command works fine as a standalone command, but fails when put into a shell script?

Android 8.1 PIXEL 2 with root access. I have seen this asked here once before but the only solution didn't help me at all. I am going to try and make this as simple as I can for the example. If I ...
0
votes
0answers
34 views

Bulk and auto install apps + phone configuration

I'm looking for a solution (free or paid) that allows me to e.g. connect an Android phone to a PC, launch a piece of software and wait until the phone is fully configured (settings, wallpaper, ...
0
votes
0answers
71 views

Run a batch file in Android

I have WhatsApp installed, and the notifications from one group that I am admin for are driving me mad. WhatsApp has the facility to "mute" notifications for 8 hours, but I have to do this ...
0
votes
0answers
40 views

Does Samsung Browser protect the user from drive-by download attack?

If I visit a malicious link with Samsung Browser, can the attacker successfully carry out a drive-by attack?
0
votes
0answers
67 views

Settings get global mobile_data always returns 0

On a rooted mediatek 6580 phone running Android 5.1.1, if data is enabled using svc data enable or even pulling down the notification bar, the command settings get global mobile_data shows an output ...
0
votes
0answers
38 views

how to add a location tracking script on android?

How can I add a custom script that retrieves the current location and also fetches current sim's cellphone number? I want to root my phone and add a script that notifies me of its location and user ...
0
votes
1answer
340 views

Is there a way to write/ run custom scripts in the background on my phone?

What I have in mind is pretty simple. I want to write a small script for simple file managing, and I would like for it to be run automatically like once a day. I have some coding experience under my ...
0
votes
0answers
61 views

Command has different output when running in a shell or in script

I'm trying to run a script on the Nox emulator through adb. After connecting to Nox via adb with adb connect localhost:62001 and copying a script into a /data/scripts/script.sh folder, executing it ...
0
votes
1answer
443 views

[Sony Xperia XZ1]Remapping camera button

Hello {darkness my old friend} I have a Sony Xperia XZ1(G8341) with AOSP GSI What I would kindly like to ask how to map the "dead" camera button to any function Currently the button doesn't work at ...
0
votes
1answer
133 views

Detail information on running scripts on the recovery screen

I am looking for more detail information regarding the process mentioned here: 1 https://forum.xda-developers.com/showthread.php?t=2058944 2 https://forum.xda-developers.com/showthread.php?t=...
0
votes
0answers
59 views

Clock resetting when battery is removed

Every time I turn off my phone and remove the battery the clock on it gets reset and it causes problem for some apps I was wondering if there is some other way to sort out the problem like is it ...
0
votes
0answers
922 views

How to create Android sepolicy based on the denial "execute_no_trans"?

I am trying to execute my script /vendor/bin/init.inmod.sh using below method: Script init.inmod.sh: #!/shebang??? /vendor/bin/test_disp hdcp disable In vendor specific .rc file: on ??? start ...
0
votes
0answers
859 views

How to press & long press the "back" key with a terminal command?

We manage Zebra Mobile computing units running on Android 6.0 Marshmallow through an MDM. For some reason, the MDM interface doesn't show the Android buttons at the bottom of the screen (back, home, ...
0
votes
0answers
354 views

Permission Denied on injected /sbin Scripts

I have an android device.. and Honor View 10... L04 version (US). I have a set of tweaks I am injecting into my kernels ramdisk, that all fire off without issue when I adb shell in and manually run ...
0
votes
1answer
79 views

Record setting changes as script?

I am looking for a way to record the setting changes I do manually, in order to be able to repeat them later by running the same script. I tried the MacroDroid app, but it doesn't look it has a "...
0
votes
1answer
2k views

Android TV autostart script

I want to run a script after booting from a Android TV box (Xiaomi Mi Box) I tried a lot but nothing works. Is there any option to 'activate' an init.d folder?
0
votes
0answers
525 views

Automate Android with script/code

I was wondering if there was a way to automate/trigger different settings the way apps like Tasker and IFTTT do directly by coding. I had in mind somethin like a script that would run on the ...
0
votes
0answers
110 views

Why sush tries to execute strings in my array as commands and how to prevent that?

When running a script that contains an array in a variable, the strings in the variable will be executed as a command, I don't need anything inside the array to be executed as a command, how to ...
0
votes
1answer
821 views

Can I make a flashable zip executing commands?

I'm using cm13 on my OnePlus 3, along with systemless SuperSu and suhide. When I update cm (often), I need to flash both SuperSu and suhide. The problem is that cm comes with root access and when ...
0
votes
1answer
490 views

Clicking a checkbox to an app using a script

I need to automate accepting a terms & conditions on a 3rd party app installed on the Android device. I just need to click a checkbox on that app's T&C UI. Can someone please guide me how I ...
0
votes
0answers
123 views

CWM recovery Nandroid Backup

Is there any way to create a Nandroid backup inside CWM recovery, by using the /cache/recovery/extendedcommand file? (This file supports all the commands a normal updater-script file supports inside ...
0
votes
0answers
437 views

How to remount /system from host shell script?

I am trying to remount the /system partition from a shell, and tried both commands suggested in this post, but it does not work. Here are the script commands I am issuing: adb shell mount | grep -e "...
0
votes
0answers
122 views

Wanted: A shell script to automate upgrades

I have a rooted Nexus 5, but this question would apply, I think, to any rooted device running Android 5.x and higher. Note also this is a question about a script to run on a osx/linux to manipulate ...