V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
songz
V2EX  ›  问与答

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

  •  
  •   songz · 2018-02-26 13:33:41 +08:00 · 1256 次点击
    这是一个创建于 2241 天前的主题,其中的信息可能已经有所发展或是发生改变。
    #!/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 条回复    2018-02-26 16:08:51 +08:00
    linyinma
        1
    linyinma  
       2018-02-26 14:09:24 +08:00   ❤️ 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
       2018-02-26 14:44:34 +08:00
    @linyinma #1 跑了一次加了 &的,sed 还是没有执行
    msg7086
        3
    msg7086  
       2018-02-26 15:29:04 +08:00   ❤️ 1
    https://gitlab.com/msg7086/dotfiles/blob/master/Rakefile#L23 我自己用的引导脚本,仅供参考。
    songz
        4
    songz  
    OP
       2018-02-26 16:08:51 +08:00
    @linyinma #1 谢谢了!我 fork 了然后注释 env zsh 就好了!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1002 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:46 · PVG 03:46 · LAX 12:46 · JFK 15:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.