The gettext command displays the Get Text dialog box and prints the text entered by the user. It's syntax is as follows:
gettext [<title>="Enter text" [<label>="" [<default>="" [<errormsg>="" [<treatnullaserror>="true"]]]]]
The "title" is the text which is displayed on the titlebar of the Get Text dialog box. It's default value is "Enter text".
The "label" is the text which is shown to the user (it usually gives user an idea about what should be entered).
The "default" is the default text which is placed in the text box.
The "errormsg" is the error message which gets printed when the user closes the Get Text dialog box by clicking on the Cancel button or if the text box is empty and "treatnullaserror" is not false.
The "treatnullaserror" specifies whether an empty string should be considered as error. It can have values "true" or "false". By default it is "true". If the text box is empty and even if the user clicks on the OK button, it is considered as an error.
Note: The parameters "title", "label", "default" and "errormsg" may be empty strings (""). In this case, the default values are used.
Example: gettext "Enter Name" "Enter your full name:" "" "No name was entered!" true
The above command displays a Get Text dialog box with title "Enter Name". "Enter your full name:" is the label displayed. "No name was entered!" is the error message shown if user keeps the text box empty or clicks on the Cancel button.
Note that the arguments which contain spaces are enclosed within a pair of double quotes.