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
echowith options - Basic script using
read - Adding comments
- Enhancing
readscripts with prompts - Limiting the number of entered characters
- Control the visibility of the entered text
- Simple scripts to enforce our learning
You have been reading a chapter from
Mastering Linux Shell Scripting
Published in:
Dec 2015
Publisher:
ISBN-13:
9781784396978
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime