[英]In Google Chrome some web pages, the font changes for no apparent reason
[英]Expect script to install Vagrant - terminating for no apparent reason
我正在運行一個簡單的Expect腳本,該腳本使用curl來拉動流浪漢dmg,附加它,安裝它並證明密碼,然后分離。
單獨地,所有命令都在命令行執行,並且安裝有效。 但是,在腳本內部執行時,它將在卷曲完成后終止。
#!/usr/bin/expect -f
set timeout 60
exec curl -O https://releases.hashicorp.com/vagrant/2.2.2/vagrant_2.2.2_x86_64.dmg
exec hdiutil attach vagrant_2.2.2_x86_64.dmg
spawn sudo installer -package /Volumes/Vagrant/vagrant.pkg -target /
expect "*?assword" { send “password” }
spawn hdiutil unmount /Volumes/Vagrant
我得到的輸出是(連接的):
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1 31.2M 1 563k 0 0 2218k 0 0:00:14 --:--:-- 0:00:01 8873k
97 31.2M 97 30.5M 0 0 9628k 0 0:00:03 0:00:03 --:--:-- 9627k
100 31.2M 100 31.2M 0 0 9668k 0 0:00:03 0:00:03 --:--:-- 9667k
while executing
"exec curl -O https://releases.hashicorp.com/vagrant/2.2.2/vagrant_2.2.2_x86_64.dmg"
(file "./vag" line 9)
這時腳本終止。
exec
將失敗。 curl
將下載進度信息輸出到stderr。 因此,您需要讓exec
忽略對stderr的輸出: exec -ignorestderr curl ...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.