bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Aw: Re: nested while loop doesn't work


From: John Kearney
Subject: Aw: Re: nested while loop doesn't work
Date: Tue, 4 Jun 2013 23:27:36 +0200 (CEST)

   as greg say this is the wrong list you need to report this to
   " Vim syntax file
   " Language:        shell (sh) Korn shell (ksh) bash (sh)
   " Maintainer:        Dr. Charles E. Campbell, Jr.
   <NdrOchipS@PcampbellAfamily.Mbiz>
   " Previous Maintainer:    Lennart Schultz <Lennart.Schultz@ecmwf.int>
   " Last Change:        Dec 09, 2011
   " Version:        121
   " URL:
   [1]http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax

   the file that does this is /usr/share/vim/vim73/syntax/sh.vim in an
   ubuntu system.


   and this is probably a simpler example to work with
   #!/bin/bash
    while true; do
     while true; do
     done
     until true; do
     done
    done
    until true; do
      while true; do
      done
     until true; do
     done
    done
   cheers



   Gesendet: Dienstag, 04. Juni 2013 um 22:15 Uhr
   Von: "Greg Wooledge" <wooledg@eeg.ccf.org>
   An: kartikkgk@gmail.com
   Cc: bug-bash@gnu.org, bash@packages.debian.org
   Betreff: Re: nested while loop doesn't work
   On Tue, Jun 04, 2013 at 04:39:31PM +0530, kartikkgk@gmail.com wrote:
   > Description:
   > A while inside a while loop (nested while) doesnt work and also the
   vim /gvim doesnt highlight the second while loop
   For issues with the vim/gvim highlighting, you'd need to report the
   problem in vim, not in bash.
   > example code is given
   >
   > while [ "ka" = $name ]
   > do
   > echo "nothing\n"
   > while [ "ka" = $name ] //this while is not highlighted
   > do
   > echo "everything\n"
   > done
   > done
   You have a quoting mistake here. "$name" should be quoted, or this will
   fail if the variable contains multiple words separate by spaces.
   imadev:~$ name="first last"
   imadev:~$ [ "ka" = $name ]
   bash-4.3: [: too many arguments
   This code should work:
   while [ "ka" = "$name" ]
   do
   printf "nothing\n\n"
   while [ "ka" = "$name" ]
   do
   printf "everything\n\n"
   done
   done
   (It goes into an infinite loop when name=ka, but presumably that's what
   you wanted.)

References

   1. 
https://3c.web.de/mail/client/dereferrer?redirectUrl=http%3A%2F%2Fmysite.verizon.net%2Fastronaut%2Fvim%2Findex.html%23vimlinks_syntax&selection=tfol11a7bad28b16cbfe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]