From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19302 invoked by alias); 2 Mar 2015 18:52:59 -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: 19959 Received: (qmail 3804 invoked from network); 2 Mar 2015 18:52:57 -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.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=8hURS/7wgVkiDlRmpwj2bpZ1w8GHFSsnS9cXht/FMMg=; b=Mt3dJOWkWMm86bFyZK49gowUjBOWR4/WFkZULCUPHGywX6yT7bSBzhfJvZU1hRzepb VVUVL09YN+uVtayoLHLbQqxMyst86xAbuPr6m0oRVhoj7BXlwlaAxu+9H9XsSdppLFlI WhquAoo1olTb2BSSLnx3iqlcjF2UZ26w6LJtgYBO1vF2n45yiKtFLcwfYnyNvxlkXT+J ZzcscJhW+dMSEIJcRYseVe58w+JUL4SR7Cga5/M61v+4isk4WbEOX1MCccsIpuSp5zby ZpQwfKoFUzTzVsv1ftExNjubJwyynWqOh6+4muq0u6S7HeeIi+NgBU01Ko7cGw/r0mWI Dv5g== X-Gm-Message-State: ALoCoQnBsJbXq0WadHxIFgSCkZ6+c+jzmszJQKqVhayfWz9Lpm4Y/UjOexpm9Z2BQo099sL4GTpx MIME-Version: 1.0 X-Received: by 10.152.6.100 with SMTP id z4mr25383992laz.114.1425322374504; Mon, 02 Mar 2015 10:52:54 -0800 (PST) In-Reply-To: <54F48D26.6040303@eastlink.ca> References: <54F33934.2070607@eastlink.ca> <13666281425228233@web7o.yandex.ru> <54F345D3.9010204@eastlink.ca> <20150302022754.GA7449@xvii.vinc17.org> <54F3E489.5050603@eastlink.ca> <54F48D26.6040303@eastlink.ca> Date: Mon, 2 Mar 2015 10:52:54 -0800 Message-ID: Subject: Re: grammar triviality with '&&' From: Kurtis Rader To: Ray Andrews Cc: Zsh Users Content-Type: multipart/alternative; boundary=089e01493e80d2bb52051052b9e5 --089e01493e80d2bb52051052b9e5 Content-Type: text/plain; charset=UTF-8 On Mon, Mar 2, 2015 at 8:17 AM, Ray Andrews wrote: > > if [ -e 'shelly.txt' ] > && [ -n "$ozymandias" ] > && [ grep "I met a traveler" ] > then > echo "Look on my works, ye mighty" > fi > Why are you using ancient Bourne-shell syntax? If you need compatibility with the Bourn-shell you can't use the feature you're asking for. If you use the slightly less ancient Korn-shell syntax you can break the test across lines the way you want: #!/bin/zsh ozymandia=yes if [[ -e 'shelly.txt' && -n "$ozymandia" && -n $(grep "I met a traveler" shelly.txt) ]] then echo "Look on my works, ye mighty" fi Note that I fixed your command as "grep" isn't a valid test; although, I wouldn't write it that way in practice as it isn't efficient. P.S., Are you aware that in the days of the Bourne-shell that the shell did not interpret tests like "-e" it simply ran the "[" command and checked its exit status. In fact that command should still exist on your system as a hardlink to the "test" command. Run $ ls -li '/bin/[' /bin/test 123034700 -rwxr-xr-x 2 root wheel 18480 Sep 9 15:44 /bin/[* 123034700 -rwxr-xr-x 2 root wheel 18480 Sep 9 15:44 /bin/test* to see this. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank --089e01493e80d2bb52051052b9e5--