我正在编写脚本来自动执行树莓派的安装和配置。我的问题是oh-my-zsh的官方安装脚本打开了一个新的外壳-zsh。这样就几乎结束了我的脚本,我需要一个单独的脚本来进行进一步的配置。我希望omz install.sh完成后继续执行我的脚本。
脚本:
. ./functions.sh
echo "\n###### install zsh ######\n"
log "apt-get install -qqy zsh"
read -p "Enter Your Name: " username
log "chsh -s /bin/zsh $username"
# this install.sh opens zsh and blocks proceeding of script
su - $username -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# I want the script to continue here
echo "More commands"
笔记:
如果RUNZSH
在运行安装程序之前将其设置为no,或者在未连接终端的标准输入下运行它,则它将不会运行该外壳程序。就您而言,< /dev/null
在命令末尾添加感觉就像是最简单的解决方案:
su - $username -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" < /dev/null'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句