Is there a way for me to run shell script in an app without needing root?
Sent from my Incredible using XDA App
Certainly. As long as the script doesn't do anything that needs elevated privileges (i.e. it can only run in the context of your app and only modify world-writable files, etc.)
What do you need your script to do?
Code:
Runtime.getRuntime().exec( "cmd" );
Related
how can i create a custom app that executes for example a shell script
i want a shortcut on the homescreen to start my vpn sh script
is that possible?
gentoo22 said:
how can i create a custom app that executes for example a shell script
i want a shortcut on the homescreen to start my vpn sh script
is that possible?
Click to expand...
Click to collapse
See GScript ... it's in the Market.
~enom~
or try the Android Scripting Environment. I prefer it over GScript.
http://android-scripting.googlecode.com/
im writing an app and it requires root permissions, can anyone help me out?
Normally you execute "sh" to open a shell and then you keep streaming commands to it.
The only difference is that you need to use "su" instead of "sh"
See http://code.google.com/p/netmeterle...statusled/utilclasses/ChargingLEDLib.java#295 for an example
Thank you so much!
Sent from my Nexus One using XDA App
Is there a way to make .bat like files? Or another way to run presaved terminal commands?
Sent from my GT-I5800 using Tapatalk
You're talking about android terminal emulators or adb shell? If so, write »#/system/bin/sh« into the first line and your commands into the following lines of a text file. Give your file execute permissions when you're done. Give it any name you like.
Then just run it from a shell prompt as you would do with any other command.
If you want do delve deeper into this, ask your favorite search engine for "shell language", "Bourne shell" or "SUSv4 shell". There are control structures, variables, functions - anything you'd expect from a full-fledged computer language.
P.S.: SD cards are often mounted with no execute permission. If your command file lives there, run it using "sh /sdcard/filename".
Thanks a lot! Very helpful!
Sent from my GT-I5800 using Tapatalk
I'm sorry if this is a noobish question but can anyone tell me what terminal and where it is that I'm supposed to use to pull and push files? I'm trying to stop the nook color Ota updates with these commands and they said to move sqlite3 file to my system/ bin then use terminal to type in these scripts. I have no idea what terminal they are talking about. Please help!! Thank you
Sent from my SAMSUNG-SGH-I997 using XDA App
Terminal emulator on the market
Sent from my HERO200 using XDA App
Many of the root tools/apps such as screencast, Helium... allow an option to start a background service through adb shell, and then connect to this service to execute commands with elevated permissions.
My idea is around generalizing this experience. There is only one app that starts a background service and acts as a proxy for all other apps (like the SuperSu app).
To make this interaction compatible with all root apps, I was thinking to writing a shell script "su" which redirects all the arguments to the above service.
This will give users with non-rooted devices access to many of the root apps.
But this will require the "su" script to be in the $PATH directory.
[Q] Is there a way to change the $PATH variable from adb shell (without root) so that it is retained system-wide? Any alternatives?