Message Dialogues

Zenity can create four types of message dialogue:

  • Error
  • Information
  • Question
  • Warning

For each type, use the --text option to specify the text that is displayed in the dialogue.

7.1. Error Dialogue

Use the --error option to create an error dialogue.

The following example script shows how to create an error dialogue:

          #!/bin/bash

          zenity --error \
          --text="Could not find /var/log/syslog."
        

Figure 5Error Dialogue Example

7.2. Information Dialogue

Use the --info option to create an information dialogue.

The following example script shows how to create an information dialogue:

          #!/bin/bash

          zenity --info \
          --text="Merge complete. Updated 3 of 10 files."
        

Figure 6Information Dialogue Example

7.3. Question Dialogue

Use the --question option to create a question dialogue.

The following example script shows how to create a question dialogue:

          #!/bin/bash

          zenity --question \
          --text="Are you sure you wish to proceed?"
        

Figure 7Question Dialogue Example

7.4. Warning Dialogue

Use the --warning option to create a warning dialogue.

The following example script shows how to create a warning dialogue:

          #!/bin/bash
        
          zenity --warning \
          --text="Disconnect the power cable to avoid electrical shock."
        

Figure 8Warning Dialogue Example