The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 01: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 03:40 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-03-2008
smintz smintz is offline
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
  #2 (permalink)  
Old 12-03-2008
Autocross.US's Avatar
Autocross.US Autocross.US is offline
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 ]
  #3 (permalink)  
Old 12-03-2008
smintz smintz is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 4
Thank you! I could have sworn I tried it. But this time it worked
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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