0

I'm using android sdk and I need to use the android command in my script, the file I need is in the following folder: /my_downloads/android-sdk/tools/android. I tried to do this in my bash script:

#!/bin/bash
ANDROID_PATH="/my_downloads/android-sdk/tools/android/"
"$ANDROID_PATH"android  # etc...

but it does not work. What is the correct way to do that maintaining that path as variable?

Thanks

1
  • 1
    Does the /my_downloads/android-sdk/tools/android/android file have the execution bit set? Also check whether execution is allowed for the parent file system: mount | grep noexec.
    – user86969
    Commented Feb 12, 2015 at 19:17

3 Answers 3

2

You should add folder with executable to your PATH as follows:

PATH="/my_downloads/android-sdk/tools/:$PATH"

And then just use:

android
0

Your shell script runs /my_downloads/android-sdk/tools/android/android (which doesn't exist).

It should instead be running /my_downloads/android-sdk/tools/android

#!/bin/bash
ANDROID_PATH="/my_downloads/android-sdk/tools/"
"$ANDROID_PATH"android  # etc...
0

Good idea is to always see where some file is located. "whereis" command by default works pretty good for that purpose.

$ whereis bash
bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .