1. Check out our companion app, Forums for Android! Download from Google Play

Root Trying to work with scripts leads me to several unix questions.

Discussion in 'Android Devices' started by desperado, Sep 21, 2010.

  1. desperado

    desperado Well-Known Member
    Thread Starter

    Jul 31, 2010
    Honolulu, HI
    1)Where can you place shell scripts you write for yourself?

    I tried placing them on the sdcard but they won't run from there.
    I tried placing them in /mnt/emmc but same problem
    I tried making a /bin folder in the root directory but it gets erased when I reboot the phone.

    Any suggestions?

    2)Is there a way to edit my PATH to include this location. Normally I would put it in .profile or .bashrc in my home directory but there doesn't seem to be a home for the phone that I can tell when I access terminal emulator. root doesn't seem to have a HOME variable set either. How can I modify my environment?

    3)Can you create a new user with specific permissions? I would like to create a user and have a folder that is only readable by that user on the phone. Maybe, not sure if this will work with apps etc.

    4)Can bash be installed?

    5)Can perl be installed?


  2. smtom

    smtom Member

    Sep 17, 2010
    SQL Programmer; SAS, Oracle, SQL Server
    Southeast USA
    Bash is supported/installed on certain ROMs.
    Recommend a look at the ROM list.
    The details of the ones that do allow bash say so. ROMs - The Incredible List
  3. I usually put mine in /system/bin and run them like you normally would. The scripts need #! /system/bin/sh at the top, instead of /bin/sh or whatever you'd normally use.
    You can also put them on the sdcard and run sh scriptname, but that's a pain.

    If you're going to be scripting, I highly recommend Better Terminal Emulator Pro. It comes with Ash, and I can't really tell any difference between it and Bash, but the latest version can also download and install Bash. It also has a home and bin directory in /data/data/com.magicandroidapps.bettertermpro. I haven't tried doing anything in there, but you could probably set aliases there and edit your path there.

Share This Page