* Junio C Hamano (gitster@xxxxxxxxx) [070921 23:58]: > David Kastrup <dak@xxxxxxx> writes: > > > Eygene Ryabinkin <rea-git@xxxxxxxxxxx> writes: > > > >>> That is, what does the shell say if you do this? > >>> > >>> case Ultra in > >>> Super) > >>> false ;; > >>> Hyper) > >>> true ;; > >>> esac && > >>> echo case returned ok > >> > >> It says 'case returned ok', so I will try to understand why it > >> works here and does not work in the 'while' construct. > > > > What you actually need to do is > > > > false > > case Ultra in > > Super) > > false ;; > > Hyper) > > true ;; > > esac && echo case returned ok > > AHHHHHH. > > Is "case" supposed to be transparent? That doesn't seem to be the case (no pun intended) on either bash or dash. Here's what I tested on bash (apologies for the long lines; these are verbatim pastes from my shell): vineet@sprocket:~$ false vineet@sprocket:~$ case Super in Super) echo super ; false ;; Hyper) echo hyper ; true ;; esac && echo case returned ok super vineet@sprocket:~$ false vineet@sprocket:~$ case Hyper in Super) echo super ; false ;; Hyper) echo hyper ; true ;; esac && echo case returned ok hyper case returned ok vineet@sprocket:~$ false vineet@sprocket:~$ case Ultra in Super) echo super ; false ;; Hyper) echo hyper ; true ;; esac && echo case returned ok case returned ok vineet@sprocket:~$ and on dash: vineet@sprocket:~$ dash $ false $ case Super in Super) echo super ; false ;; Hyper) echo hyper ; true ;; esac && echo case returned ok super $ false $ case Hyper in Super) echo super ; false ;; Hyper) echo hyper ; true ;; esac && echo case returned ok hyper case returned ok $ false $ case Ultra in Super) echo super ; false ;; Hyper) echo hyper ; true ;; esac && echo case returned ok case returned ok $ So it seems like a "case" statement isn't special; it returns a status like any other statement. Vineet -- http://www.doorstop.net/ - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html