Respond to Prompt in Bash Script
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:
# ... some directives here
# Remove the machine, confirming "y" when asked by docker-machine
echo 'y' | docker-machine rm default
# ... more directives here
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.
I don't, however, know how to handle multiple prompts -- can you tell me and everyone else?
You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...
One of the worst kept secrets about AJAX on the web is that the underlying API for it,
XMLHttpRequest, wasn't really made for what we've been using it for. We've done well to create elegant APIs around XHR but we know we can do better. Our effort to...
Increase the font size, follow a link to another web page on same site and … back...
One major gripe that we've always had about CSS is that creating layouts seems to be more difficult than it should be. We have, of course, adapted and mastered the techniques for creating layouts, but there's no shaking the feeling that there should be a...