July 2017
Beginner
208 pages
3h 7m
English
This chapter shows how to read the keyboard in order to create interactive scripts.
The topics covered in this chapter are:
read built-in command to query the keyboard.read.The reader will learn how to create interactive scripts.
The scripts we have looked at up to this point have run without much user interaction. The read command is used to create scripts that can query the keyboard. The code can then take action based on the input.
Here is a simple example:
#!/bin/sh # # 5/16/2017 # echo "script1 - Linux Scripting Book" echo "Enter 'q' to quit." rc=0 while [ $rc -eq 0 ] do echo -n "Enter a string: " read str echo "str: ...
Read now
Unlock full access