Link to home
Start Free TrialLog in
Avatar of bganoush
bganoush

asked on

How to write while loop on a single line?

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?
ASKER CERTIFIED SOLUTION
Avatar of tfewster
tfewster
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial