启动后在终端中挂起Bash进程

时间:2018-09-02 04:41:13

标签: bash terminal

这对我来说是新鲜的领域,所以我为自己的无知向您道歉。

我第一次在终端中工作,并且相信我在尝试调整安装过程中要解决的软件包的路径时弄乱了bash shell。

我正在研究macOS High Sierra 10.13.6(如果有帮助的话)。

在终端中,运行代码:

    cd ~
    /bin/bash
    perl -MNet::FTP -e \
      '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", Passive => 1);
       $ftp->login; $ftp->binary;
       $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
    gunzip -c edirect.tar.gz | tar xf -
    rm edirect.tar.gz
    builtin exit
    export PATH=$luke:$HOME/edirect >& /dev/null || setenv PATH 
    "$luke:$HOME/edirect"
    ./edirect/setup.sh

编辑自(在最后几行中将“ $ {PATH}”替换为“ $ luke”):

    cd ~
    /bin/bash
    perl -MNet::FTP -e \
      '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", Passive => 1);
       $ftp->login; $ftp->binary;
       $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
    gunzip -c edirect.tar.gz | tar xf -
    rm edirect.tar.gz
    builtin exit
    export PATH=${PATH}:$HOME/edirect >& /dev/null || setenv PATH 
    "${PATH}:$HOME/edirect"
    ./edirect/setup.sh

运行第一个块后,运行的bash进程始终无法完成,我无法停止它。我可以使用其他外壳打开终端。但是,使用默认值(或/ bin / bash)打开将产生以下结果:

    Last login: Sun Sep  2 00:13:58 on ttys000

...无法输入任何内容,无法进行bash运行(有时可能是perl),并且由于自己不小心摆弄有趣的新玩具而对自己的灵魂深感失望。

我的.bash /个人资料:

    # Added by install_latest_perl_osx.pl
    [ -r /Users/luke/.bashrc ] && source /Users/luke/.bashrc
    export PATH=${PATH}:/Users/luke

我的.bashrc:

    source /Users/luke/perl5/perlbrew/etc/bashrc
    export PATH=${PATH}:/Users/luke/edirect
    export PATH=~/src/edirect:$PATH
    export PATH=~/src/edirect:$PATH
    export PATH=~/src/edirect:$PATH
    export PATH=~/src/edirect:$PATH
    export PATH=~/src/edirect:$PATH
    export PATH=~/src/edirect:$PATH
    export PATH=~/src/edirect:$PATH
    source ~/.bash_profile

我的.bash_history:

    perl -MNet::FTP -e   '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", 
    Passive => 1);
       $ftp->login; $ftp->binary;
       $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
    gunzip -c edirect.tar.gz | tar xf -
    rm edirect.tar.gz
    builtin exit
    perl -MNet::FTP -e     '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", 
    Passive => 1);
        $ftp->login; $ftp->binary;
        $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
    gunzip -c edirect.tar.gz | tar xf -
    rm edirect.tar.gz
    builtin exit
    perl -MNet::FTP -e   '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", 
    Passive => 1);
       $ftp->login; $ftp->binary;
       $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
    gunzip -c edirect.tar.gz | tar xf -
    rm edirect.tar.gz
    builtin exit
    perl -MNet::FTP -e   '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", 
    Passive => 1);
       $ftp->login; $ftp->binary;
       $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
    gunzip -c edirect.tar.gz | tar xf -
    rm edirect.tar.gz
    builtin exit
    tar -xvf openssl-0.9.8zg.tar
    brew install openssl
    export CPATH=/usr/local/opt/openssl/include
    export LIBRARY_PATH=/usr/local/opt/openssl/lib
    cpan install Crypt::OpenSSL::RSA
    mkdir -p ~/src 
    curl https://ftp.ncbi.nlm.nih.gov/entrez/entrezdirect/edirect.zip > 
    ~/src/edirect.zip 
    unzip -o ~/src/edirect.zip  -d ~/src
    echo 'export PATH=~/src/edirect:$PATH' >> ~/.bashrc 
    source  ~/.bashrc
    efetch -db pubmed -id 1413997,6301692,781293 -format xml |   xtract 
    -pattern PubmedArticle -PMID MedlineCitation/PMID     -block Author 
    -element "&PMID"       -sep " " -tab "\n" -element 
    Initials,LastName
    ftp-cp ftp.ncbi.nlm.nih.gov /entrez/entrezdirect xtract.Darwin.gz
      gunzip -f xtract.Darwin.gz
      chmod +x xtract.Darwin
    export PATH=$PATH: ~/edirect
    cd ~
    /bin/bash
    export PATH=${PATH}:$HOME/edirect >& /dev/null || setenv PATH 
    "${PATH}:$HOME/edirect"
    ./edirect/setup.sh
    cd ~
    /bin/bash
    export PATH=$luke:$HOME/edirect >& /dev/null || setenv PATH 
    "$luke:$HOME/edirect"
    ./edirect/setup.sh
      echo "source ~/.bash_profile" >> $HOME/.bashrc
      echo "export PATH=\${PATH}:/Users/luke" >> $HOME/.bash_profile
    efetch -db nuccore -id AF086833 -format fasta
    efetch -db pubmed -id 1413997,6301692,781293 -format xml | >   
    xtract -pattern PubmedArticle -PMID MedlineCitation/PMID >     - 
   block Author -element "&PMID" >       -sep " " -tab "\n" -element 
    Initials,LastName
    export PATH=$PATH: ~/edirect
    efetch -db pubmed -id 1413997,6301692,781293 -format xml |   xtract 
    -pattern PubmedArticle -element MedlineCitation/PMID     -element 
    Initials LastName
    cd ~
    /bin/bash

很抱歉将所有内容都丢给您! 非常感谢您将系统恢复到正常状态的任何帮助。

干杯, 卢克

其他信息:

@tripleee 在edirect / setup.sh中:

    #!/bin/bash -norc

    DIR="$( cd "$( dirname "$0" )" && pwd )"

    cat <<EOF

    Trying to establish local installations of any missing Perl modules
    (as logged in $DIR/setup-deps.log).
    Please be patient, as this step may take a little while.
    EOF

    cd "$DIR"

    mkdir -p _cpan/CPAN
    echo '1;' >> _cpan/CPAN/MyConfig.pm
    if ! perl -I_cpan -Iaux/lib/perl5 setup-deps.pl </dev/null >setup- 
    deps.log 2>&1
    then
      if grep '^read timeout.*HTTP' setup-deps.log >/dev/null
      then
        cat <<EOF
    Unable to access the Comprehensive Perl Archive Network.  You might
    need to set http_proxy and/or ftp_proxy in your user environment.
    Please consult your network administrator for suitable values.
    EOF
      elif grep '^SSLeay\.xs:.*[Ee]rror:' setup-deps.log >/dev/null
      then
        cat <<EOF
    Unable to build Net::SSLeay.  Please install either a prebuilt 
    version
    of this module or OpenSSL development files to build it against.
    EOF
      fi
    fi
    rm -rf _cpan

    if ! perl -Iaux/lib/perl5 -MMozilla::CA -e '1;' 2>/dev/null
    then
      gzip -cd Mozilla-CA.tar.gz | tar xvf -
    fi

    osname=`uname -s`
    cputype=`uname -m`
    case "$osname-$cputype" in
      Linux-x86_64 )           platform=Linux ;;
      Darwin-x86_64 )          platform=Darwin ;;
      CYGWIN_NT-* | MINGW*-* ) platform=CYGWIN_NT ;;
      Linux-*arm* )            platform=ARM ;;
      * )                      platform=UNSUPPORTED ;;
    esac

    if [ -n "$platform" ]
    then
      ./ftp-cp ftp.ncbi.nlm.nih.gov /entrez/entrezdirect 
    xtract."$platform".gz
      gunzip -f xtract."$platform".gz
     fi

    if [ -f xtract."$platform" ]
    then
      chmod +x xtract."$platform"
    else
      echo "Unable to download xtract executable."
    fi

    if [ -n "$platform" ]
    then
      ./ftp-cp ftp.ncbi.nlm.nih.gov /entrez/entrezdirect 
    rchive."$platform".gz
      gunzip -f rchive."$platform".gz
    fi

    if [ -f rchive."$platform" ]
    then
      chmod +x rchive."$platform"
    else
      echo "Unable to download rchive executable."
    fi

    echo ""
    echo "Entrez Direct has been successfully downloaded and 
    installed."
    echo ""

    prfx="In order to complete the configuration process, please 
    execute the following:\n"

    target=bash_profile
    if ! grep "$target" "$HOME/.bashrc" >/dev/null 2>&1
    then
      if [ ! -f $HOME/.$target ] || grep 'bashrc' "$HOME/.$target" 
    >/dev/null 2>&1
      then
        target=bashrc
      else
        if [ -n "$prfx" ]
        then
          echo -e "$prfx"
          prfx=""
        fi
        echo "  echo \"source ~/.bash_profile\" >>" "\$HOME/.bashrc"
      fi
    fi
    if ! grep "PATH.*edirect" "$HOME/.$target" >/dev/null 2>&1
    then
      if [ -n "$prfx" ]
      then
        echo -e "$prfx"
        prfx=""
      fi
      echo "  echo \"export PATH=\\\${PATH}:$DIR\" >>" 
    "\$HOME/.$target"
    fi

    if [ -z "$prfx" ]
    then
    echo ""
    echo "or manually edit the PATH variable assignment in your 
    .bash_profile file."
    echo ""
    fi

0 个答案:

没有答案