我正在尝试切换到一个目录并在我的whiptail
对话框屏幕中运行其他命令,但是在克隆了我的 git 存储库之后,我的脚本在尝试切换到目录时似乎正在死机:
STATUS=0
touch log.txt
while [ $STATUS -lt "100" ]; do
echo "cloning Repo" >> log.txt
git clone git@git.bitbucket.org:abc/repo.git /repo >> log.txt 2>&1
echo "changing directory" >> log.txt
cd /repo >> log.txt 2>&1
echo `pwd`
echo "installing bundler" >> log.txt
gem install bundler --no-ri --no-rdoc >> log.txt 2>&1
(( STATUS += 99 ))
echo $STATUS
done | whiptail --gauge "Setting Up Neo (THIS WILL TAKE SOME TIME)..." 40 78 0
;;
使用 记录命令set -x
,如下所示:
:66+STATUS=0
:67+touch log.txt
:149+whiptail --gauge 'Setting Up (THIS WILL TAKE SOME TIME)...' 40 78 0
:68+'[' 0 -lt 100 ']'
:71+echo 'apt-get update'
:73+(( STATUS += 15 ))
:74+echo 15
:77+echo 'apt-get upgrade'
:79+(( STATUS += 15 ))
:80+echo 30
:83+echo 'apt-get -y git-all'
:85+(( STATUS += 15 ))
:86+echo 45
:111+(( STATUS += 30 ))
:112+echo 75
:115+rm -rf /repo
:116+echo 'cloning Repo'
:117+git clone git@git.bitbucket.org:abcd/repo.git /repo
:118+echo 'changing directory'
:119+cd /repo
::120+pwd
:120+echo /repo
:121+echo 'installing bundler'
:122+gem install bundler --no-ri --no-rdoc
:148+echo 100
:68+'[' 100 -lt 100 ']'
:5+true
::11+whiptail --title 'Configuration Menu' --menu 'Choose an option' 40 78 30 1 'Show current configuration.' 2 'Setup Wizard.' 0 Exit
log.txt
stop at和我的whiptail 菜单的输出changing directory
返回到主页(好像设置已完成,但这不是因为我也应该在日志中看到pwd
and ):installing bundler
cloning Repo
Cloning into '/repo'...
changing directory
我没有收到任何错误,因此诊断正在发生的事情对我来说是个问题。任何帮助表示赞赏!