#! /bin/bash # Name: setwatch # Purpose: Change the Hardware and system time just like # Syntax: setwatch # Author: Michel Bisson # History: 18.09.2003 First inplementation of script #---------------------------------------------------------- # Show dialg box with current time and date # Ask for today's Day todayd=$(date +%d) echo -n "Enter today's Day (01-31) [$todayd]:";read day [ "$day" = "" ] && day=$todayd # Ask for today's Month todaym=$(date +%m) echo -n "Enter today's Month (01-12) [$todaym]:";read month [ "$month" = "" ] && month=$todaym # Ask for today's Year todayy=$(date +%Y) echo -n "Enter today's Year (2000-2030) [$todayy]:";read year [ "$year" = "" ] && year=$todayy #echo "Today's date is: $month/$day/$year" #exit 0 # Ask for today's time via dialog pop-up window time=$(dialog --stdout --timebox "Hardware/System time setting: \nDate: $month/$day/$year" 0 0) if [ "$time" ] ; then # Set the hardware clock #format: hwclock --set --date="9/22/2002 16:45:05" hwclock --set --date "$month/$day/$year $time" # Sets the system time to current hardware clock hwclock --hctosys fi # Show the new Hardware and System date and time echo "Present Hardware Clock setting is: $(hwclock)" echo "Present System Clock setting is: $(date)" exit 0