[英]Error -bash: .: /usr/bin/[: cannot execute binary file on cygwin
I was executing a script to clone code from some local repository on my virtual system through cygwin prompt: 我正在执行一个脚本,以通过cygwin提示符从虚拟系统上的某些本地存储库克隆代码:
mkdir CPM_WORKAREA
touch ~/.ssh/config
{
echo "Host gerrit.epk.ericsson.se"
echo " HostkeyAlgorithms ssh-dss"
echo " Hostname 136.225.198.208"
echo User $signumid
echo "PubKeyAuthentication yes"
echo "IdentityFile ~/.ssh/id_rsa"
} > ~/.ssh/config
cd ~/CPM_WORKAREA
git clone ssh://gerrit.epk.ericsson.se:29418/tools/devenv devenv.x
git config --global user.email $1
mkdir -p /proj/env
ln -s /usr/bin /proj/env/bin
cd
if ! grep -q 'alias vi=vim' .bashrc ; then
{
echo "alias vi=vim" >> .bashrc
echo 'export USER='$signumid'' >> .bashrc
echo 'export DEVENVHOME=${DEVENVHOME:-/home/'$signumid'/CPM_WORKAREA/devenv.x}' >> .bashrc
echo '. $DEVENVHOME/sourceme.sh' >> .bashrc
}
else
{
sed -i "s/.*USER.*/export USER=$signumid/
s% .*DEVENVHOME=[$].*% DEVENVHOME=\${DEVENVHOME:-/home/$signumid/CPM_WORKAREA/devenv.x}%" .bashrc
}
fi
if ! grep -q 'EDITOR=vim' .bash_profile ; then
{
echo "EDITOR=vim" >> .bash_profile
echo "export EDITOR" >> .bash_profile
echo '. [ -r $HOME/.bashrc ] && . $HOME/.bashrc' >> .bash_profile
}
fi
touch .vimrc
{
echo "set nocp"
echo "syntax on"
} > .vimrc
After executing this script, when i am closing the cygwin prompt and then opening it again, it shows : 执行此脚本后,当我关闭cygwin提示符然后再次打开它时,它显示:
-bash: .: /usr/bin/[: cannot execute binary file
at the top of the cygwin prompt. 在cygwin提示的顶部。
I saw some review that the error is due to executing the script on some wrong architecture. 我看到一些评论,认为该错误是由于在某些错误的体系结构上执行脚本引起的。
So, I tried checking the .bashrc
file to check out what changes are being made in the .bashrc
file after the script is executed. 所以,我想检查.bashrc
文件,检查出的正在做哪些改变.bashrc
执行脚本后的文件。 But I could not figure out how the changes being made are leading to this error. 但是我不知道所做的更改是如何导致此错误的。
The problem is this line: 问题是这一行:
echo '. [ -r $HOME/.bashrc ] && . $HOME/.bashrc' >> .bash_profile
This creates a profile that wants to "source the [
command" (which is not a shell script, but a binary file). 这将创建一个配置文件,该配置文件要“来源[
命令”(不是shell脚本,而是二进制文件)。 It looks like the .
看起来像.
in . [
在中. [
. [
shouldn't be there. . [
不应该在那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.