Ubuntu 下执行sh脚本 报错 :No such file or directory

Ubuntu 下执行sh脚本 报错 :-bash: ./build_xx.sh: /bin/sh^M: bad interpreter: No such file or directory

执行sh脚本报这个错,很是郁闷,但是目录下的确有这个文件。

网上搜索找到答案--https://superuser.com/questions/344533/no-such-file-or-directory-error-in-bash-but-the-file-exists

原因:我的机器是64位的,需要32位的支持库。在Ubuntu 13.10及以后版本中依赖了 libncurses5:i386, libstdc+6:i386,and zlib1g:i386的包。

down vote

Android SDK requires 32-bit libraries. You probably are on 64-bit and need the 32-bit libs. Here are the troubleshooting directions from developer.android.com

For Ubuntu 13.10 (Saucy Salamander) and above, install the libncurses5:i386libstdc++6:i386, and zlib1g:i386 packages using apt-get:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

For earlier versions of Ubuntu, install the ia32-libs package using apt-get:

apt-get install ia32-libs

所以执行如下命令进行安装包:

down vote
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
就可以了。

你可能感兴趣的:(linux)