由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - expect question
相关主题
Debian update后挂掉了问一个C Shell的sed用法。
dd 要先 make filesystem 么?问一个bash stream output parse的问题
28T分区Let a non-root user turn off computer
怎样在环境变量里加换行符?what packages needed to init 5 X11
请教一个简单的内存规范程序 (转载)MATLAB 2009 on RHEL5
换行符 \\ 不工作 (转载)Autologin
命令行下如何批量替换文件里的换行符 (转载)这边高手多,问个简单网络问题
emacs 里一堆 ^M 咋整?成功安装Chrome OS到硬盘上
相关话题的讨论汇总
话题: expect话题: mke2fs话题: return话题: trying话题: question
进入Linux版参与讨论
1 (共1页)
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
2
Try "y\r"?
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
5
why not:
mke2fs -F ...
x*z
发帖数: 1010
6
send -- "y\r"

【在 c******n 的大作中提到】
: tried, doesn't work
: even tried "y\g", as someone suggested
: thanks

1 (共1页)
进入Linux版参与讨论
相关主题
成功安装Chrome OS到硬盘上请教一个简单的内存规范程序 (转载)
问个基础问题,关于linux command存放地址换行符 \\ 不工作 (转载)
Newbie question命令行下如何批量替换文件里的换行符 (转载)
ubuntu sudo PATH issueemacs 里一堆 ^M 咋整?
Debian update后挂掉了问一个C Shell的sed用法。
dd 要先 make filesystem 么?问一个bash stream output parse的问题
28T分区Let a non-root user turn off computer
怎样在环境变量里加换行符?what packages needed to init 5 X11
相关话题的讨论汇总
话题: expect话题: mke2fs话题: return话题: trying话题: question