Monday, September 26, 2011

Android sh script, why failed with [ not found

A simple sh script, but run failure with error: [ not found.
#!/system/bin/sh
if [ $? eq 0 ]; then
    echo "Command run successful"
fi
The same script can run well on Linux.
I dont know why, but I finally got a solution.
Upload a busybox, change it to executable permissions, create a soft link "[" to busybox. Like the following:
-rwxr-xr-x 500      500       1877260 2011-09-22 02:42 busybox
lrwxrwxrwx root     root              2011-09-26 08:15 [ -> /sbin/busybox
Run the sh script again, which shall give no error any more.
Finally, make sure the searching path $PATH can find command "busybox", and "[".

19 comments:

Jasmine Carrel said...

I am first time to your site and after searching some pages I have decided to visit you regularly, as I have liked you site too much.
Amoxicillin Dosage

eswari said...

Awesome details, I really appreciate the way you provided.Thanks for giving.I am happy to have study some of them on your site. Best Website Hosting

sabreena said...

Thanks for sharing such an interesting information. I think this is really a very nice post. Thanks for the great content!


----------------

iphone blackjack

Aanya said...

Thanks for sharing such useful information. It seems that you did a lot of hard work for this article. Keep it up.

--------------------------
Everest Poker Review

sabreena said...

Very informative and impressive article. unique information.


-----------

ipad casino

sabreena said...

Nice post love your blog.This blog is awesome full of use full information that i was in dire need of. Thanks for this post. Keep it up.


-----------------

ipad poker

sabreena said...

Thanks for sharing such an interesting information. I think this is really a very nice post. Thanks for the great content!


-------------

android bingo

sabreena said...

Thanks for sharing such useful information. It seems that you did a lot of hard work for this article. Keep it up.


-------------

android slots

Stacey said...
This comment has been removed by the author.
sabreena said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general,
The usefulness and significance is overwhelming.
Thanks again and good luck!



------------

android roulette

sabreena said...

It’s a Good blog and congrats on having good Information, Keep it up! Thanks for sharing your knowledge with us!




----------------

Leadership Development

catriona said...

Contents good. Thank you. I want you to be successful




teambuilding middle east

hassan said...

I agree totally.
free casino comps

hassan said...

Thanks for sharing with us this tip . I’ll use this anti spyware to see if it’s good . I always had problems with spywares , that is already a part of this internet ….
poker community

Android app development said...

I like your blog analyze.This is one of the well defined post.I will again look forward towards this post.Keep it up.
Android app developer

Opensource Development said...

It's a good topic you have chosen, it will be helpful for programmers. drupal developers

Unknown said...

Your articles don’t beat around the bushes exact t to the point.
penalties for dui

Unknown said...

I’d should speak with you right here. Which is not anything It’s my job to do! I really like reading an post which will make individuals feel. Also, thanks for permitting me to comment!Best advertising Agency in the world | top advertising agencies in pakistan | Marketing Agency | pakistani matrimonial

Unknown said...


I will be really glad my spouse and I witnessed an excellent web site. I have to thank a lot a lot of information! I enjoy we have saved your website for brand new things to examine sand on the roads.
Low cost and high quality 2d animation