Solved

How to write while loop on a single line?

Posted on 2008-06-24
1
7,910 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

785 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