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 "[".

21 comments:

sahib said...

Thanks for the information. I’m really glad that you share your ideas about this. I must relay these ideas to my friends.
doctor reviews by patients
find doctor list

saim said...

Nice post. We are impressed by your clear description of your topic. Thanks for the information. Keep on writing.

find doctor list

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

Best Hosting Service 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

Ian bell said...

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

ali khan 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

Best Article Websites 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