The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
On "event at a time" vs. "set at a time" processing iBot Complex Event Processing RSS News 0 11-07-2008 12:10 PM
How to remove "New line characters" and "spaces" at a time anushree.a Shell Programming and Scripting 4 09-08-2008 05:55 PM
add seconds to: date"|"time"|"HHMMSS anaconga UNIX for Advanced & Expert Users 3 08-27-2008 01:17 PM
Sed , Replace a "variable text" inside of a statement jackn7 Shell Programming and Scripting 4 03-04-2008 02:40 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 12:52 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-03-2008
Registered User
 

Join Date: Jun 2006
Posts: 4
help with "if" statement for TIME

This should be incredibly simple, but can't get it to work.
All I want to do is pause a script between 11:00 am and noon.

I receive the following error:
time.sh[4]: 13:55:45: syntax error

script:
1 while true
2 do
3 TIME=$(date '+%H:%M:%S')
4 if [ $TIME -ge 11:00:00 ] -a [ $TIME -le 12:00:00 ]
5 then
6 echo "time between 11:00 and noon"
7 echo sleep time $TIME
8 sleep 3
9 else
10 echo "time all others"
11 fi
12 done
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-03-2008
Autocross.US's Avatar
Registered User
 

Join Date: Nov 2008
Location: Chesapeake, VA
Posts: 73
Try removing the colons from your time variable and if statement:

Code:
TIME=$(date '+%H%M%S')
if [ $TIME -ge 110000 ] -a [ $TIME -le 120000 ]
Reply With Quote
  #3 (permalink)  
Old 12-03-2008
Registered User
 

Join Date: Jun 2006
Posts: 4
Thank you! I could have sworn I tried it. But this time it worked
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 11:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66