轉載時請註明出處和作者聯繫方式
文章出處:http://blog.csdn.com/keensword007
作者聯繫方式:琴劍 <keensword007 at sina dot com>
從android網站下載ndk-1.6後,執行設置腳本後,出現如下錯誤:
chenzhengyong@chenzhengyong-laptop:~/workspace/android/android-ndk-1.6_r1$ ./build/host-setup.sh
Checking host development environment.
NDK Root : /home/chenzhengyong/workspace/android/android-ndk-1.6_r1
GNU Make : make (version 3.81)
[: 205: Pass: unexpected operator
[: 205: Pass: unexpected operator
[: 205: Pass: unexpected operator
ERROR: Could not find a valid Nawk or Gawk executable.
Please ensure that either one of them is installed.
Use the --no-awk-check option to ignore this message.
將host-setup.sh腳本第119行由
if [ "$result" == "Pass" ] ; then
改成
if [ "$result" = "Pass" ] ; then
再執行,就不會有問題了。
爲什麼會出現這種錯誤呢,翻看了一下bash shell編程資料,=和==應該是等價的。但是我使用的ubuntu 9.04版本/bin/sh卻是鏈到dash,因此另一個解決方法是修改第一行,將
#!/bin/sh
改成
#!/bin/bash
dash全稱爲Debian Almquist shell,它比bash小得多,速度快,但功能有所縮減。現在大部分腳本都是bash腳本,所以一勞永逸的做法是:
sudo rm /bin/sh
sudo ln -s bash /bin/sh