Beyond the Sky

The place where surface stop and share the experience of life

shutdown script using xmessage or zenity

,

Uses xmessage
#!/bin/sh
# Say bye to shutdown your pc

#uses xmessage to ask first.
answer=$(xmessage  "Are you sure you want to shutdown? " -buttons yes,no -print)
if [ $answer = "yes" ]
then
        # Do shutdown at here.
        #Ubuntu probably needs gksudo instead of sudo
        sudo init 0;
fi


Uses zenity
#!/bin/sh
# Say bye to shutdown your pc

#uses zenity to ask first.
zenity --question --title "Shutdown Confirmation" \
--text "Are you sure you want to shutdown?"

if [ "$?" -eq "0" ]
then
        # Do shutdown at here.
        #Ubuntu probably needs gksudo instead of sudo
        sudo init 0;
fi

insert special symbol in linuxLogo for LBE (Linux By Example)

Comments

Unregistered user Sunday, September 19, 2010 5:30:23 AM

4ndr3 writes: nice one, I did the same script for my fluxbox with xmessage :D from portugal, finishing Computer Science master degree

Write a comment

New comments have been disabled for this post.