博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sh脚本和bash脚本_响应Bash脚本中的提示
阅读量:2524 次
发布时间:2019-05-11

本文共 1195 字,大约阅读时间需要 3 分钟。

sh脚本和bash脚本

I work on a project that requires I frequently build and destroy a virtual machine.  I don't enjoy having to do so but virtual machines can be notoriously difficult to prop up, especially when you have a complex app living within it.

我从事的项目需要经常构建和销毁虚拟机。 我不喜欢这样做,但是众所周知,虚拟机很难支撑,尤其是当其中包含复杂的应用程序时。

Manually typing the same commands over and over can be mind-numbing so I've create a bash script to handle all of the work for me.  One hiccup to the process is needing to confirm removal of an existing virtual machine; using a pipe and echo allows me to answer the prompt:

一遍又一遍地手动键入相同的命令可能会让人麻木,因此我创建了一个bash脚本来为我处理所有工作。 困扰该过程的一个问题是需要确认已删除现有虚拟机。 使用管道和echo可以回答提示:

# ... some directives here# Remove the machine, confirming "y" when asked by docker-machineecho 'y' | docker-machine rm default# ... more directives here

Using echo I pipe a y response to docker-machine's confirmation prompt, thus allowing the script to move forward with other tasks without the need for manual intervention.

使用echo我将对docker-machine的确认提示的响应发送给y ,从而使脚本可以继续执行其他任务,而无需手动干预。

I don't, however, know how to handle multiple prompts -- can you tell me and everyone else?

但是,我不知道如何处理多个提示-您能告诉我和其他所有人吗?

翻译自:

sh脚本和bash脚本

转载地址:http://tkpwd.baihongyu.com/

你可能感兴趣的文章
Activiti源码浅析:Activiti的活动授权机制
查看>>
数位dp整理
查看>>
UNIX基础知识
查看>>
bzoj 1179: [Apio2009]Atm
查看>>
利用LDA进行文本聚类(hadoop, mahout)
查看>>
第三周作业
查看>>
js添加删除行
查看>>
浏览器性能测试网址
查看>>
[MTK FP]用Python把图片资源image.rar中为.pbm后缀的文件更改为.bmp后缀的方法
查看>>
实验二
查看>>
[LeetCode]203. Remove Linked List Elements 解题小结
查看>>
测试一下
查看>>
vue base64
查看>>
【Django实战开发】案例一:创建自己的blog站点-1.安装及搭建开发环境
查看>>
Pie(二分)
查看>>
Mysql 索引优化
查看>>
09湖州二模(自选模块不等式)
查看>>
Mybatis Batch 批量操作
查看>>
Ubuntu server搭建Java web服务器
查看>>
WSGI学习系列WSME
查看>>