期望在bash脚本中无法正常工作

时间:2018-05-15 15:50:33

标签: linux bash unix expect

我正在尝试使用bash脚本自动化存储库文件传输(到另一个存储库)。我制作了脚本并且它非常简单,但我不想每次都手动输入密码。我正在使用一个看似不起作用的期望。

#!/bin/bash
#!/usr/bin/expect  

mkdir temp
cd temp

git -c http.sslVerify=false clone https:Repository_One.git 

expect -exact "Password for 'https://Repository_One.com':" { send "Password\r" }:

cd $1

web=Repository_Two

git remote set-url origin $web
git push -u origin --all

expect -exact "Password for 'https://Repository_Two.com':" { send "Password2\r" }:

cd ..
cd ..
rm -r temp

0 个答案:

没有答案