使用 yes 命令发生死锁

使用 yes 命令发生死锁

我有一个名为setup.sh

. install.sh && . tolinux.sh && . startn.sh && . startm.sh

这是install.sh

yes | sudo apt-get update
yes | sudo apt-get install default-jdk
yes | sudo apt-get install expect
sudo apt-get install lftp

cd /usr/local/src/
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xf noip-duc-linux.tar.gz
cd noip-2.1.9-1/

/usr/bin/expect <<END_SCRIPT
spawn make install
expect "Please enter the login/email*" { send "Username\r" }
expect "Please enter the password for user*" { send "password\r" }
expect "Please enter an update interval*" { send "30\r" }
expect "Do you wish to run something at successful update*" {send "N\r" }
END_SCRIPT

这就是我在终端中运行整个过程的方式:

. setup.sh

yes命令在前两行中的某处导致问题。我知道这两个安装都需要确认。所发生的输出类似于以下内容:

y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
ySelecting previously unselected package libdatrie1:amd64.
Preparing to unpack .../libdatrie1_0.2.8-1_amd64.deb ...
Unpacking libdatrie1:amd64(0.2.8-1) ...
[several similar lines]
Selecting previously unselected package libpango-1.0-0:amd64.
Preparing to unpack .../libpango-1.0-0_1.36.3-1ubuntu1_amd64.deb ...
Unpacking libpango-1.0-0:amd64 (1.36.3-1ubuntu1) ...
_

(最后一个下划线是光标不断闪烁的地方)

我猜该yes命令以某种方式中断了安装,但我不明白为什么或如何......

有任何想法吗?

答案1

man apt-get

   -y, --yes, --assume-yes
       Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an
       undesirable situation, such as changing a held package, trying to install a unauthenticated package or
       removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.

你有没有尝试过 ?

编辑

我对 install.sh 的建议

 sudo apt-get -y update
 sudo apt-get -y install default-jdk
 sudo apt-get -y install expect
 sudo apt-get install lftp

 # rest unchanged

相关内容