You will need to follow the sequence of commands below to move the current
'date' command file to another directory and then create a new 'date' file
that will access the old one when needed. I am assuming a minimal knowledge
of unix. Please type as shown as unix is case sensitive. Make sure you use
the grave(`) and single quote(') as shown.
comments(do not type these)
login as root
cd /bin current location of 'date'
mkdir date1 create new directory
cp date date1 copy to new directory
ls -l date1 verify copy
rm date remove old copy
vi date create new file
i start inserting text
if test $2 check for second entry on command line
then if 2nd entry exists, do this
a=`expr $2 - 1900` subtract 1900
if test $2 -le 1999 is it less then or equal to 99
then /bin/date1/date $1$a if yes then set date
else if no, do this
a=`expr $a - 99` subtract 99
/bin/date1/date 1231235999 set date to 12/31/99 23:59
while test $a -ne 0 repeat the following until $a is 0
do
echo 'Waiting 1 minute' waiting message
sleep 61 wait one minute for rollover
a=`expr $a - 1` decrement $a counter
/bin/date1/date 12312359 set date to 12/31 23:59 in that year
done repeat for each year beyond 1999
/bin/date/date $1 set current date and time
fi
else if 2nd entry does not exist, do this
if test $1 check for first entry
then /bin/date1/date $1 if exists, then set date
else /bin/date1/date if does not exist, show current date
fi
fi
esc key end edit
ZZ save file and exit
mode 755 date makes file executable
The new 'date' command should now work. It follows the old format with the
capability of adding the year. If you are trying to synchronise the clock to
a specific time, remember to add one minute for each year beyond 1999.
usage: date [mmddhhmm[yy]] [ccyy]
examples:
date
gives current date and time
date 08241350
set date to 8/24 13:50 in current year
date 0824135099
set date to 8/24/99 13:50
date 08241350 2001
set date to 8/24/99 13:50 in 2001 (takes two minutes to complete)
You may contact me at the address below if you have any questions or comments.
Allan Kershaw
Director of NMR Instrumentation
Phone 213 740-6376
email allan@kershaw.usc.edu
WWW http://nmrnet.usc.edu