Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

share|improve this question
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. – Nasha Feb 12 at 19:17

3 Answers 3

up vote 1 down vote accepted

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

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

And then just use:

android
share|improve this answer

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
share|improve this answer

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...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.