Linux shell脚本 自动输入提示信息或回车进行下一步操作

版权声明:Boomlee https://blog.csdn.net/BoomLee/article/details/82704186

1.应用场景

有的时候执行安装或操作第三方软件时,需要输入Yes 或者回车 才能进行下一步

例如操作sqlite

[root@lee sh]# sqlite3 anhui.db 
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> 

需要使用命令进入sqlite命令行后,才可以输入命令执行sql语句

2.解决办法

echo .read anhui.sql |sqlite3 anhui.db 

在脚本里这么写,直接就会执行。

若有更好的办法,欢迎指教~

猜你喜欢

转载自blog.csdn.net/BoomLee/article/details/82704186
今日推荐