User Tools

Site Tools


Privacy Policy


Version 2.50 is out since Jan 1st 2022

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


shell access

This code will allow you to execute shell code as if it has been typed in a terminal application.

This should work on devices whether they have been rooted or not.

var globs={};
//Called when application is started.
function OnStart()
  var lay = app.CreateLayout("Linear","Vertical,FillXY");
  var txtopts = "MultiLine,ReadOnly,NoKeyboard,NoSpell,Left,MonoSpace"
  var txt = app.CreateTextEdit("Please wait", -1, -1, txtopts);
  globs.sys = app.CreateSysProc( "sh" );
  globs.stdout = "/sdcard/stdout.txt"
  globs.redir = " >> " + globs.stdout + " 2>&1 \n ";
  //check PATH variable
  sysEcho( "$PATH", true );
  sysOut("SJG=Steve ;export SJG");
  //list all environment variables
  sysOut( "set", true );
  sysOut( "set | grep STOR", true );
  //display filesystem
  sysOut("df", true);
  //Change directory
  sysOut("cd /sdcard");
  //show path
  sysOut("pwd", true);
  sysOut("ls -l");
  //test stderr
  sysOut("ls -l /data");
function sysEmpty(stamp)
    if(stamp) sysStamp();
function sysOut (cmd, stamp)
   if(stamp) sysStamp();
   globs.sys.Out(cmd + globs.redir)
function sysEcho(msg, stamp)
    sysOut('echo "' + msg +'"', stamp );
function sysStamp()
    var d = new Date();
    sysEcho(d.toISOString()+" *");
sample_code/shell.txt · Last modified: 2015/03/21 05:32 (external edit)