From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14415 invoked by alias); 3 Jun 2013 04:25:30 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17818 Received: (qmail 2009 invoked from network); 3 Jun 2013 04:25:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.223.172 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=6dq063tRjXq+vUDmck+caNQF4sfs35M9F1KKXz+wLkc=; b=z3Fu8M7rwPpfiK5u8Sauu44s1h33PKRPoODg+RfOjO/kdYwrxsCwDjyesKea5m2Pg3 8Vl8Y53DCc/aS0FNoGZvJ6GYKYbHFvQ1Coqhtpo+CTSOaGYuVN4CPGTIxuRajjSJEWsM LHPo1Hph0hqbrPHleaaX9XDsnthOnG2WkW3lHz1SZ/BlYvsj4HtE+rsHAJEj7E3WVeoW huq8SIR/ElThFQ81Rq+4X1mu0IjYOqkMiCkLmzi9CpAgf5meswy7gIvmqDEqhNNPk76m ZJp55zcdbd5nBDmLNaprK36EYMHmXACl0Lv8ARmKvpN++lXvOJFEkBOzULEz8eK1U8Un UeeQ== X-Received: by 10.50.141.161 with SMTP id rp1mr7006437igb.11.1370233516039; Sun, 02 Jun 2013 21:25:16 -0700 (PDT) MIME-Version: 1.0 From: TJ Luoma Date: Mon, 3 Jun 2013 00:24:35 -0400 Message-ID: Subject: while {some command does not exit = 1) To: Zsh-Users List Content-Type: text/plain; charset=UTF-8 I keep thinking that there must be an easier way to do this, but I can't figure out what it would be, and Google has not helped. I'm trying to create a "while" loop which will keep going as long as some command does not exit = 0 Here's what I have been doing: #!/bin/zsh -f EXIT=1 while [ "$EXIT" = "1" ] do drutil discinfo | fgrep -q 'Please insert a disc to get disc info.' EXIT="$?" FOO done exit 0 # EOF (where 'FOO' is some command I want to run) What I keep thinking I ought to be able to do is something like this while ((! drutil discinfo | fgrep -q 'Please insert a disc to get disc info.' )) do FOO done I realize that "while (( ))" syntax is wrong, but I hope the idea is clear. It appears that the | might be what is making this not work. Is there an easier way to do this? TjL