/usr/bin/expect <<EOF
spawn vue init webpack test-study-pro
expect “Project name (test-study-pro)”
send “\r\n”
expect “Project description (A Vue.js project)”
send “\r\n”
expect “Author”
send “\r”
expect “.Runtime + Compiler: recommended for most users*”
send “\r”
expect “Install vue-router? (Y/n)”
send “y\r”
expect “Use ESLint to lint your code? (Y/n)”
send “y\r”
expect “.Standard (https://github.com/standard/standard)*”
send “\r”
expect “Set up unit tests (Y/n)”
send “n\r”
expect “Setup e2e tests with Nightwatch? (Y/n)”
send “n\r”
expect “Yes, use NPM”
send “\r”
expect eof
EOF
shell 交互式问答式自动化脚本spawn和expect
最新推荐文章于 2025-09-02 17:09:42 发布
本文介绍了如何利用expect工具创建交互式shell脚本,通过示例展示了在vue项目初始化过程中,自动回答配置问题,提高了自动化部署的效率。
1460

被折叠的 条评论
为什么被折叠?



