The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
whats wrong with this code nadman123 Shell Programming and Scripting 4 04-15-2008 05:42 PM
how i prepare a c++ code(c code) for implementing my own protocol format amitpansuria High Level Programming 1 09-06-2007 08:09 PM
What's wrong with this code? mmignot Shell Programming and Scripting 3 11-08-2006 03:02 AM
Can someone review my code tell me where I am going wrong? chrchcol Shell Programming and Scripting 4 07-28-2006 03:54 PM
SSH key code versus server key code Texan Security 1 04-12-2006 08:57 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-23-2003
Registered User
 

Join Date: May 2003
Posts: 14
Question What is wrong with this code?

Hello everyone, can somebody tell me what is wrong with this code:
Code:
while true
do
	java myTime > myTime.log
	sleep 60
done
I get the following error:

./myTime: Syntax error at line 1 : `while' is not matched.

Thanks in advance!
Forum Sponsor
  #2  
Old 06-23-2003
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Re: What is wrong with this code?

Quote:
Originally posted by Lem2003
Hello everyone, can somebody tell me what is wrong with this code:
Code:
while true
do
	java myTime > myTime.log
	sleep 60
done
I get the following error:

Try using : (NULL operator) instead of true. What shell are you in?
  #3  
Old 06-23-2003
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Is it complaining about the script you posted or the script it is running via java?

The code you posted works and gives no error on Solaris 8 (the 'java' line was not tested).

I tried the code in both sh and ksh (you should post what you are coding in and the OS/version).
  #4  
Old 06-23-2003
Registered User
 

Join Date: May 2003
Posts: 14
Thanks guys!
I'm working on HP-UX Release 11i: November 2000 in sh. I also tried:
Code:
while :
do
	java myTime > myTime.log
	sleep 60
done
And it does not work. I get the same error. Thanks once again.
  #5  
Old 06-23-2003
Registered User
 

Join Date: May 2003
Posts: 14
I found the problem! I was using a scprit made in notepad. I used vi and found a bunch of funny chars. Thanks everybody.
  #6  
Old 06-23-2003
oombera's Avatar
Registered User
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
DOS/Windows text files have a Carriage Return and Line Feed at the end of the file, whereas Unix files have only a Line Feed (no carriage return). ^M is the carriage return...

See this webpage for more info: UNIX vs DOS/WINDOWS File Formats
  #7  
Old 06-23-2003
Registered User
 

Join Date: May 2003
Posts: 14
Thumbs up

Yeah ^M was what I found in the script!
Google The UNIX and Linux Forums
Closed Thread

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0