出现: bad interpreter: No such file or directory的解决办法

 
在linux下执行一个shell脚本报错
如:
[root@prajna fix]# ./install.sh -i /opt/IBM/tivoli/tip/
: bad interpreter: No such file or directory
出现的原因是不同的系统编码有所不同,在windows中编辑过的.sh文件可能含有linux中不可见的字符,导致无法执行,
 
只需要将文件的编码转换一下即可,
如在linux中:
[root@prajna share]# more aa.sh 
echo  aaa >>/test
 
[root@prajna share]# ./aa.sh 
: command not found
[root@prajna share]# vi aa
echo  aaa >>/test
 
~
~
~
  fileformat=dos
[root@prajna share]# 
在命令模式下输入(:set ff)然后回车会显示文件的格式如(fileformat=dos),然后改为unix即可(输入:set ff=unix然后回车即可)