In the very beginning of a script stands:if [ -z $DISPLAY ]then  DIALOG=dialogelse  DIALOG=XdialogfiI understand, that$DISPLAY holds the value of which pseudo-terminal one is attached to[ -z $DISPLAY ] tests whether $DISPLAY has a value or is an empty stringWhat is the purpose of $DISPLAY keeping a value, what is different when it has an empty string?Why would it be crucial for the further execution of the script to know whether [ -z $DISPLAY ] is true or false ? 
What is the purpose of testing $DISPLAY with [ -z $DISPLAY ]?
shell script;environment variables;test
Whatever this script is, it's using the $DISPLAY value to determine if it's running in an X11 environment or not (if the script is running in e.g. a desktop environment, $DISPLAY will be set). It doesn't care about the actual value at all.If it is running in X11, it sets DIALOG to Xdialog, which presumably is a X11 program for displaying dialog boxes.If it's not running in X11 (for example, it's on a headless machine or in an SSH-session), it sets DIALOG to dialog, which presumably is a curses (or at least text-based) program for displaying dialog boxes.Later, the script may use $DIALOG to display a dialog box appropriate for the user.