Chapter 2. Creating Interactive Scripts
In Chapter 1, The What and Why of Scripting with Bash, we learned how to create a script and use some of its basic elements. These included optional parameters that we can pass through to the script when it is executed. In this chapter, we will extend this by using the shell's built-in read command to allow for interactive scripts. Interactive scripts are scripts that prompt for information during the script's execution.
In this chapter, we will cover the following topics:
- Using
echowith options - Basic script using
read - Script comments
- Enhancing read scripts with
readprompts - Limiting the number of entered characters
- Controlling the visibility of the entered text
- Passing options
- Read options values
- Try to be standard
- Enhancing learning with simple scripts