From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26354 invoked by alias); 2 Mar 2015 19:09:36 -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: 19960 Received: (qmail 7651 invoked from network); 2 Mar 2015 19:09:31 -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,T_FSL_HELO_BARE_IP_2 autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1425322992; bh=orSHIL6J626hTw2wdlnNAXxumNRZlcLHNBNfV4Eb60M=; h=From:To:Cc:In-Reply-To:References:Subject:Date; b=ePmTlshcXCq7pkPStAZEh3u9beg1/ZV68IPXKBI9le0/R0RbnHAdGwQj5nEf6P/ir j43RoL3jpvWCRgMuL2rbJfa2dEgl9usU41h/UZxIXXn4+cwLnHVdCLf5lVnC87qZID 780UJ+Gb8W1PhOo9W6m3R3j1Z2/iCkoWrE+GjblU= From: ZyX To: Kurtis Rader , Ray Andrews Cc: Zsh Users In-Reply-To: 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> Subject: Re: grammar triviality with '&&' MIME-Version: 1.0 Message-Id: <3716401425322991@web19h.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Mon, 02 Mar 2015 22:03:11 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r 02.03.2015, 21:54, "Kurtis Rader" : > 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* Why hardlink and why in /bin? % la /usr/bin/{test,\[} -rwxr-xr-x 1 root 39K ÑÎ× 31 04:03 /usr/bin/[* -rwxr-xr-x 1 root 35K ÑÎ× 31 04:03 /usr/bin/test* : you see there is a 4K difference. Not sure why, but both belong to coreutils package. > > to see this. > > -- > Kurtis Rader > Caretaker of the exceptional canines Junior and Hank