bobo
1
set DAY=`date +%y%m%d`
set H=`date +%H`
set M=`date +%M`
mailx -s "$H-Mydata" myemail@mail.com<mydata
I am looking to set the current hour to have 1 hour less in the subject header:
For example: let's say the system time is 8
I want to have "7-Mydata" not "8-Mydata"
Can some1 helps?
Many thanks!
Go into the FAQ and look for datecalc - Perderabo wrote a script to handle time/date arithmetic.
let HOUR=$(date +%H)-1
echo ${HOUR}
Works in korn and bash
What happens if it is midnight? Would't the HOUR get set to -1?
Good question 
Pesky 00's
if (( $(date +%H) < 1 )); then
HOUR=23
else
let HOUR=$(date +%H)-1
fi
Something like this probably.
#!/bin/csh
if( `date +%H` < 1 ) then
set HOUR=23
else
set HOUR=`date +%H`
set HOUR=`expr $HOUR - 1`
endif
echo $HOUR
But this may not be as elegant of efficient as it should be. I'm no csh scripter.