WebProWorld.com Jayde.com SecurityProNews.com | Breaking eBusiness News Submit An Article Advertise About Us Archives Information Technologies Web Development Enterprise eBusiness Home
SecurityProNews > IT > Operating Systems > User Friendly Date Script

[ it_operating_systems ]

User Friendly Date Script


A.P. Lawrence | Contributing Writer
2003-03-31



Setdate

The "setdate" is just a more user-friendly front end to changing the date and time:

echo -n "Enter Date or leave blank for `date +%m/%d/%y`: " 
read mydat
echo -n "Enter Time or leave blank for `date +%H:%M`: " 
read mytime
if [ "$mydat" != "" ]
then
      mmdd=`echo $mydat | sed 's////g;s/..$//'`
      yr=`echo $mydat | sed 's////g;s/^....//'`
else
      mmdd=`date +%m%d`
      yr=`date +%y`
fi
if [ "$mytime" != "" ]
then
      newtime=`echo $mytime | sed 's/://g'`
else
      newtime=`date +%H%M`
fi
date "$mmdd$newtime$yr"





This script works on Linux, SCO and most other Unixes.

Please read this disclaimer
Copyright and reprint info

View All Articles by A.P. Lawrence


About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

More it_operating_systems Articles
iEntry Featured Services: Jayde Member Services | Forums | Freeware | Advertise with Us