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?
I get asked loads of questions every day but I'm always surprised that they're rarely questions about code or even tech -- many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes...
Once concept I'm very fond of is lazy loading. Lazy loading defers the loading of resources (usually images) until they are needed. Why load stuff you never need if you can prevent it, right? I've created LazyLoad, a customizable MooTools plugin that...
Before we start, I want to say thank you to David for giving me this awesome opportunity to share this experience with you guys and say that I'm really flattered. I think that CSS animations are really great. When I first learned how CSS...