• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

shell command file extentions

Trogue

Lurker
Hello i am new to android and this forum.i was wondering what is the file extention for running commands shells. eg .bat (windows) Is there a extention for it at all or do i have to enter them individualy in terminal editor.
 
Welcome to AF! :)

I'm sure you could do something via ADB if you had the Android SDK installed. Not my forte though but I'll see if any of the other guides can assist.
 
Welcome to the AndroidForums, Trogue!

Well, there are mime type file extensions (i.e., the files / programs associated with each file's extension suffix) that Android uses to associate things when you "reference" them (i.e., invoked in the proper context with the proper program).

You can see this with something like Astro File Manager (free in the Market) by going to menu -> More -> Preferences -> Edit File Extensions.

Now, what happens when you try to invoke/launch/run a particular file with its associated program I believe depends on whether or not you've installed a program that knows how to handle it (i.e., listens for system intents based on the given mime file type). You can see an example of this long-pressing a .txt file and seeing what programs show-up and are available to be launched with this .txt file type (its because the program has a compatible SEND mime type in its AndroidManifest.xml file).

In addition to the excellent example that Xyro mentioned, Gscript / Gscript Lite, there is also a similar program called Script Manager. These guys know how to invoke a sh shell program and feed the commands listed in a given script file to the sh shell and re-display the results to the Android window.

As far as launching things from a terminal emulator, well, that's just like a telnet client that you would see in Unix/Linux, so, all Unix-type rules apply (i.e., the #!<program path>-type references at the start of the script, etc.). The file must also be located in a non-SD card filesystem and its permission bits properly set if you are to execute it directly. Or, you'll have to invoke a shell (sh) and give it the name of the text file (.sh) containing your shell commands (i.e., "sh myscript.sh").

You best bet might be to create your files in a text editor on your PC, then invoke them with Gscript or Script Manager, or directly from a terminal window on your phone. You'll also have to be aware that you are pretty limited in what you can do without being rooted--many of the most useful commands are not present unless you have a busybox utility installed.

Cheers!
 
iv downloaded script manager because its free .sh seems to work on it
Thanks for the help

Trogue,

I should point-out that there is a free version of Gscript called Gscript Lite (https://market.android.com/details?id=nl.rogro.GScriptLite&feature=search_result).

I've actually only used Gscript Lite...I don't have any experience with Script Manager, but after looking at the Market Description, it certainly does look interesting and very full-featured (I'll have to check it out).

Cheers!
 
Back
Top Bottom