previous  next  contents

Xdialog documentation - General syntax and usage


 

Usage:

Xdialog [<common options>] [<transient options>] <box option> ...

The [<common options>] [<transient options>] <box option> sequence may be repeated several times in the same Xdialog command line (this is called dialog chaining). The common/transient options may be omited but there must always be a <box option> as the last Xdialog option.

On completion of each box option (i.e. every time a widget is closed) Xdialog sends any result (text, numbers) as one or more strings to stderr (this can be changed so that the results are sent to stdout thanks to a common option).

When Xdialog terminates (i.e. when all the <box options> are processed or when an error occurs), the exit code may take the following values:

Note that when chaining dialogs, the chain is broken and Xdialog terminates as soon as a widget returns a non zero exit code.

When using Xdialog from a shell, it is therefore usually invoked as follow:

RESULTS=`Xdialog --stdout ...` # It is also possible to redirect Xdialog output to a temporary file.
EXIT_CODE=$?
case $EXIT_CODE in
    0) # All OK. The $RESULTS variable holds everything entered/choosed by the user.
       .../...
       ;;
    1) # Cancel/No pressed.
       .../...
       ;;
  255) # An error occured or the box was closed.
       .../...
       ;;
esac

For examples of how to use each widget, please read the common options section of this documentation and browse the samples directory.

Note: There are also two special options (--version and --print-version) that make Xdialog to print its version number to stderr and exit. This is useful to check from a script if the installed version of Xdialog is able to use some of the latest widgets that have been implemented since Xdialog exists... The difference between --version and --print-version is that the later prefix the version number with "Version: " (in a cdialog compatible way).


previous  next  contents