简体   繁体   English

错误-bash:。:/ usr / bin / [:无法在cygwin上执行二进制文件

[英]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.

相关问题 这个错误的原因是什么“/ usr / bin / sudo:/ usr / bin / sudo:无法执行二进制文件” - what is the reason for this error “/usr/bin/sudo: /usr/bin/sudo: cannot execute binary file” / usr / local / bin / ffmpeg:无法执行二进制文件 - /usr/local/bin/ffmpeg: cannot execute binary file / usr / local / bin / vim:无法执行二进制文件:EXEC格式错误 - /usr/local/bin/vim: cannot execute binary file: Exec format error /usr/bin/bash: 没有这样的文件或目录 - /usr/bin/bash: No such file or directory 从execv启动终端(sh)返回错误:/ bin / sh:/ bin / sh:无法执行二进制文件 - start terminal (sh) from execv return error : /bin/sh: /bin/sh: cannot execute binary file -bash:./ a.out:无法执行二进制文件:exec格式错误 - -bash: ./a.out: cannot execute binary file: Exec format error bash:无法执行二进制文件exec格式错误fortran - bash: cannot execute binary file exec format error fortran gradlew 错误:/usr/bin/env: bash: No such file or directory - Error with gradlew: /usr/bin/env: bash: No such file or directory 无法执行命令 /usr/bin/bash - Could not execute command /usr/bin/bash Cygwin报告“-bash:/ usr / bin / svn:Bad address” - Cygwin reports “-bash: /usr/bin/svn: Bad address”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM