c******n 发帖数: 4965 | 1 I am trying to write a script to do some machine setup steps.
one of them is to make a file system. the mke2fs sometimes asks for a
confirmation, so I'm trying to use
expect.
the following is the expect file
################
set timeout 3600
spawn /sbin/mke2fs '$DEVICE'
expect "Proceed anyway? (y,n)"
send "y\n\n"
#####################
but after I ran this, expect seems to feed in the "y", but the answer does
not return, instead I have to manually
type the RETURN key , then it will go forward.
anybody knows where I'm wrong?
thanks | x**m 发帖数: 941 | | c******n 发帖数: 4965 | 3 tried, doesn't work
even tried "y\g", as someone suggested
thanks
【在 x**m 的大作中提到】 : Try "y\r"?
| h*******x 发帖数: 12808 | 4 how about try
"y\r\n" or "y\n" or "y\n\r" or "y\r\n\r\n"?
\r \n都是换行符,有的系统用其中的一个,有的系统两个都用。有时候还要发两边。
【在 c******n 的大作中提到】 : tried, doesn't work : even tried "y\g", as someone suggested : thanks
| S*A 发帖数: 7142 | | x*z 发帖数: 1010 | 6 send -- "y\r"
【在 c******n 的大作中提到】 : tried, doesn't work : even tried "y\g", as someone suggested : thanks
|
|