Questions
- You want to create a graphical user interface for a shell script that will run on a wide variety of Linux, Unix, and Unix-like operating systems. Which of the follow utilities would you use for best availability?
zenity
cdialog
xdialog
yad
- Which of the following statements is true about this code snippet?
command -v Xdialog
if [[ -n $DISPLAY ]] && [[ $? == 0 ]]; then
diag=Xdialog
else
diag=dialog
fi
- It’s good code, and will work just fine.
- It won’t work, because it uses the wrong method to detect if the
Xdialog
executable is present. - It won’t work, because it’s not possible to detect if a certain executable is present.
- It won’t work, because having the
[[ -n $DISPLAY ]]
test come first ensures that$?
always returns a value of 0.