Chapter 2. Creating Interactive Scripts
In Chapter 1, What and Why of Scripting with Bash, of this book we learned how to create a script and use some of its basics elements. These include optional parameters that we can pass through to the script when it is executed. In this chapter, we will extend this by using the read shell built-in command to allow for interactive scripts. Interactive scripts are scripts that prompt for information during the script execution. In doing so, we will cover the following topics:
- Using
echo
with options - Basic script using
read
- Adding comments
- Enhancing
read
scripts with prompts - Limiting the number of entered characters
- Control the visibility of the entered text
- Simple scripts to enforce our learning
Using echo with options ...
Get Mastering Linux Shell Scripting now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.