问题描述
问:我得到这个错误信息:
Question: I get this error message:
出口:不好间preTER:没有这样的文件
或目录
当我执行此bash脚本:
when I execute this bash script:
#!/bin/bash
MONO_PREFIX=/opt/mono-2.6
GNOME_PREFIX=/opt/gnome-2.6
export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH
PS1="[mono-2.6] \w @ "
但在bash路径似乎是正确的:
But the bash path seems to be correct:
asshat@IS1300:~/sources/mono-2.6# which bash
/bin/bash
asshat@IS1300:~# cd sources/
asshat@IS1300:~/sources# cd mono-2.6/
asshat@IS1300:~/sources/mono-2.6# ./mono-2.6-environment
export: bad interpreter: No such file or directory
asshat@IS1300:~/sources/mono-2.6# ls
download mono-2.4 mono-2.4-environment mono-2.6 mono-2.6-environment
asshat@IS1300:~/sources/mono-2.6# cp mono-2.6-environment mono-2.6-environment.sh
asshat@IS1300:~/sources/mono-2.6# ./mono-2.6-environment.sh
export: bad interpreter: No such file or directory
asshat@IS1300:~/sources/mono-2.6# ls
download mono-2.4-environment mono-2.6-environment
mono-2.4 mono-2.6 mono-2.6-environment.sh
asshat@IS1300:~/sources/mono-2.6# bash mono-2.6-environment
asshat@IS1300:~/sources/mono-2.6#
我是什么做错了吗?或者这是一个清醒山猫错误?
What am I doing wrong? Or is this a Lucid Lynx bug?
我没有使用chmod + X
推荐答案
第一行:#!/斌/庆典
The first line: #!/bin/bash
告诉Linux在哪里可以找到除preTER。
Tells linux where to find the interpreter.
这是极有可能,您创建该文件与Windows编辑器,它会放置一个< CR>< LF>
在每行的末尾。这是在DOS / Windows的标准。然而,在UNIX / LINUX,标准只是把一个< LF方式>
在该行的末尾
It is highly likely that you created this file with a windows editor, which will place a <cr><lf>
at the end of each line. This is the standard under dos / windows. However, under Unix / linux, the standard is to just put a <lf>
at the end of the line.
的Linux现在正在寻找一个名为 /斌/ bash的&LT文件; CR&GT;
国米preT文件,
其中,&LT; CR&GT;
是一个回车符,这是linux下的一个有效的文件字符。这样的文件不存在。因此,错误。
Linux is now looking for a file called /bin/bash<cr>
to interpret the file,where <cr>
is a carriage return character, which is a valid file character under linux. Such a file doesn't exist. Hence the error.
解决方法:修改文件在Linux上的编辑和摆脱多余的&LT; CR&GT;
Solution: Edit the file with an editor on linux and get rid of the extra <cr>
.
这篇关于Bash脚本:不好间preTER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!