Solved

How to write while loop on a single line?

Posted on 2008-06-24
1
7,904 Views
Last Modified: 2013-12-26
Hi ppl,

I have this one line in my shell script that looks like this:

x=`date +"%H"` ; echo $x ; while [ $x -lt 12 ] ; do ; x=`date +"%H"` ; done

It makes sense to me but when I run it, I get this error:

ksh: syntax error: `;' unexpected

What am I doing wrong?
0
Comment
Question by:bganoush
1 Comment
 
LVL 20

Accepted Solution

by:
tfewster earned 500 total points
ID: 21858103
Remove the ; after the word "do" and it will work
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert OverPunch 25 62
delete a folder ever 5 minutes 6 60
remove spaces from a file name linux 3 52
Problem to event 3 78
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now