bash quandry

Luciano Rocha strange at nsk.no-ip.org
Wed Jun 20 07:36:25 UTC 2007


On Tue, Jun 19, 2007 at 09:08:04PM -0700, charles f. zeitler wrote:
> i'm having problems with getting a while loop to work.
> this script:
> 
> #!/bin/bash
> 
> 
> while [ 1 ] 
> do 
> done
> 
> when run, gives these error messages:
> 
> /home/fedora/0_scripts/done.ba: line 6: syntax error near unexpected token
> `done'
> /home/fedora/0_scripts/done.ba: line 6: `done'
> 
> at the command line,
> 
> while [ 1 ] ; do ; done
> 
> gives: bash: syntax error near unexpected token `;'
> 
> and,
> 
> while [ 1 ]  do ; done
> 
> gives: bash: syntax error near unexpected token `done'
> 
> can anyone give me a pointer?
> 
> thanx

As you've already been told, you're missing the command list to run.

If you want an infinite loop:
while : ; do : ; done


: equals /bin/true

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070620/1bbae8af/attachment-0001.sig>


More information about the fedora-list mailing list