|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Script for timezone
Hi all
We have Production Sun servers with Solaris 9. On these servers the time zone is set for GMT. We are planning for a script which gives us the EST time on the same servers when executed. Your tips/web site details/scripts are welcome. Thanks |
|
#2
|
|||
|
|||
|
Timezone
Pl refer my query and the output from date command on our system
bash-2.05$ date Fri Feb 4 22:21:35 GMT 2005 I want to store one line awk script in a file which upon execution displays the output for the date command as bash-2.05$ date Fri Feb 4 17:21:35 EST 2005 (GMT = EST+5) My awk string gives the flg o/p. bash-2.05$ date | awk {'print $4'} | awk -F: {'print $1 -= 5'} 17 I want the o/p to be at least17:21:35 if not Fri Feb 4 17:21:35 EST Your help is appreciated. Thanks |
|
#3
|
|||
|
|||
|
what will happen say at 2AM GMT time?
|
|
#4
|
|||
|
|||
|
a) why do you assume people are using bash ?
b) why piping the awk ouput to an other awk ? c) what if $1 (of your second awk) in < 5 ? d) why not read man pages ? you could learn unix. |
|
#5
|
|||
|
|||
|
Hi vgersh99
Now the EST here is 10:57AM on 7th Feb. The out from date bash-2.05$ date Mon Feb 7 15:57:50 GMT 2005 Thanks |
|
#6
|
|||
|
|||
|
Hi guggach
Quote:
Hi guggach Can you pl make your point 'c)' little clear? I appreciate that. Thanks. |
|
#7
|
||||
|
||||
|
Quote:
- when you write scripts NEVER assume a specific language i know a lot of sys w/o bash and ksh so write portabe, use the old good bourne, it runs on EVERY *nix - if you are writing 'bash' for performance, note 'shells' are NOT performant, try perl or better. - if you disturb 'awk', let it do the job, no need for a second one and make checks, the line Quote:
imo is simply bad, try something like awk '{if(5 >$4) exit(1); print $4-5;}' ensure $4 is an integer, c people call that: casting awk '{if(5 >$4+0) exit(1), print $4-5;}' or awk '{if(5 >$4*1) exit(1), print $4-5;}' NOTE: no need of 'else' statement, and the notation: 1 >x and x< 1 are not really the same working w/ other progs (awk is not concerned, but still a good practice) the compiler will help you if you use the first one. - manuals are my bible ![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Script for timezone |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|