[英]How to run shell script from a shell script without terminating it
我正在開發一個Shell腳本,它將為我安裝Debian軟件包,復制配置文件等。
問題是當我嘗試執行外部腳本時,父腳本被終止了,我有一個像這樣的腳本:
# changing shell
chsh -s $(which zsh)
# installing oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-
zsh/master/tools/install.sh -O -)"
# copying zsh config file
rsync -a .zshrc ~/
運行第二步后,我的腳本終止。
謝謝
我想你需要這樣的東西
sh -c "sleep 3" &
echo "We are waiting"
wait
在這里,您可以檢查wait
https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.