#!/bin/bash
(相关资料图)
###EOF输入式
/usr/bin/expect <<EOF
###设置超时10秒终止
set time 10
spawn fdisk /dev/sda
###expect匹配上双引号中的内容就执行后续动作
expect {
"*" { send "m\r" }
}
expect {
"*" { send "p\r" }
}
expect {
"*" { send "q\r" }
}
expect eof
###按照之前的终止符终止
EOF
关键词:
#!/bin/bash
(相关资料图)
###EOF输入式
/usr/bin/expect <<EOF
###设置超时10秒终止
set time 10
spawn fdisk /dev/sda
###expect匹配上双引号中的内容就执行后续动作
expect {
"*" { send "m\r" }
}
expect {
"*" { send "p\r" }
}
expect {
"*" { send "q\r" }
}
expect eof
###按照之前的终止符终止
EOF
关键词: