Using xmessage
to display a text dialog with a question: "Are you sure you want to reboot?"
If you user clicked, on yes, it will reboot your computer by issuing the command systemctl reboot
.
#!/bin/sh answer=$(xmessage "Are you sure you want to reboot?" -buttons yes,no -print) if [ "$answer" == "yes" ];then systemctl reboot fi
Output