The input box (inputbox)

Whenever we want to ask a user to input text via the keyboard, in such situations, the inputbox option is useful. While entering text via the keyboard, we can use keys such as Delete, Backspace, and the arrow cursor keys for editing. If the input text is larger than the input box, the input field will be scrolled. Once the OK button is pressed, the input text can be redirected to a text file:

    # dialog  --inputbox  "Please enter something."   10  50 
    2> /tmp/tempfile
    VAR=`cat ~/work/output.txt
  

Let's write the dialog_02.sh shell script to create an input box as follows:

#!/bin/bash result="output.txt" >$ $result # Create ...

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.