Skip navigation.

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)

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31