V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
songz
V2EX  ›  问与答

请教 shell script (bash) 安装 oh my zsh 的问题

  •  
  •   songz · Feb 26, 2018 · 1855 views
    This topic created in 2995 days ago, the information mentioned may be changed or developed.
    #!/bin/bash
    echo ";;;;;;;;;;zsh"
    sudo apt-get install zsh -y
    
    echo ";;;;;oh-my-zsh"
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    
    echo ";;;;;; sed"
    sed -i "s/git$/git colorize sudo extract zsh-autosuggestions/g" $HOME/.zshrc
    

    以上是在树莓派上的一个 aa.sh 脚本内容,在干净的 rasp lite 系统里执行

    但是

    脚本只执行到 oh my zsh,之后的 sed 就不执行了

    脚本退出后就自动变成 zsh 了

    其他的内容,在 zsh 下再跑一次 aa.sh 就可以了

    有什么方法不让脚本在 bash 下中断呢?

    4 replies    2018-02-26 16:08:51 +08:00
    linyinma
        1
    linyinma  
       Feb 26, 2018   ❤️ 1
    卡在 install.sh main 函数最后执行了 env zsh,aa.sh 修改如下即可:
    sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh) &"
    songz
        2
    songz  
    OP
       Feb 26, 2018
    @linyinma #1 跑了一次加了 &的,sed 还是没有执行
    msg7086
        3
    msg7086  
       Feb 26, 2018   ❤️ 1
    https://gitlab.com/msg7086/dotfiles/blob/master/Rakefile#L23 我自己用的引导脚本,仅供参考。
    songz
        4
    songz  
    OP
       Feb 26, 2018
    @linyinma #1 谢谢了!我 fork 了然后注释 env zsh 就好了!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1021 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 18:30 · PVG 02:30 · LAX 11:30 · JFK 14:30
    ♥ Do have faith in what you're doing.