|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Search this Thread |
|
#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! |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
Go into the FAQ and look for datecalc - Perderabo wrote a script to handle time/date arithmetic.
|
|
#3
|
||||
|
||||
|
let HOUR=$(date +%H)-1
echo ${HOUR} Works in korn and bash |
|
#4
|
||||
|
||||
|
Quote:
|
|
#5
|
||||
|
||||
|
Quote:
![]() Pesky 00's if (( $(date +%H) < 1 )); then HOUR=23 else let HOUR=$(date +%H)-1 fi |
|
#6
|
|||
|
|||
|
#!/usr/bin/csh
Thanks! |
|
#7
|
||||
|
||||
|
Something like this probably. Code:
#!/bin/csh
if( `date +%H` < 1 ) then
set HOUR=23
else
set HOUR=`date +%H`
set HOUR=`expr $HOUR - 1`
endif
echo $HOURBut this may not be as elegant of efficient as it should be. I'm no csh scripter. |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding mail per hour | Prince2 | Shell Programming and Scripting | 2 | 05-22-2008 12:50 PM |
| generating data for 1 hour | aajan | Shell Programming and Scripting | 0 | 03-17-2008 04:59 AM |
| help in hour grep | ali560045 | Shell Programming and Scripting | 0 | 01-31-2008 02:03 AM |
| how to calculate busy hour | shary | Shell Programming and Scripting | 14 | 01-29-2008 05:04 AM |
| an hour less in 24 hour system | bobo | UNIX for Dummies Questions & Answers | 3 | 10-23-2006 11:55 AM |