expectコマンドで以下のようなシェルを書いています。
lang
1expect -c " 2set timeout 30 3spawn env LANG=C /usr/bin/ssh root@192.168.43.204 4expect \"password:\" 5send \"abc\n\" 6expect \"root@abc504\" 7send \"sh /root/yesno.sh\n\" 8expect \"Type yes or no.\r\" 9send \"yes\" 10exit 0 11"
lang
1#!/bin/sh 2 3echo "Type yes or no." 4read answer 5 6case $answer in 7 yes) 8 echo -e "tyeped yes.\n" 9 echo "yes" >> /root/yesno.log 10 ;; 11 no) 12 echo -e "tyeped no.\n" 13 echo "no" >> /root/yesno.log 14 ;; 15 *) 16 echo -e "cannot understand $answer.\n" 17 echo "other" >> /root/yesno.log 18 echo $answer >> /root/yesno.log 19 ;; 20esac 21
上記を実行すると、expectでyesを入力しているはずなのに、シェルの実行結果では、
何も入力されておらず、その他扱いとなってしまいます。
何が原因でしょうか??

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/26 23:29