From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12522 invoked by alias); 26 Nov 2015 19:09:08 -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: 20998 Received: (qmail 22494 invoked from network); 26 Nov 2015 19:09:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1448564592; bh=jzN48Hz9z94aurnKKYV+hEFaI0o3U17Ala8jH6evPbk=; h=From:To:In-Reply-To:References:Subject:Date; b=ll45s8QKU3PeVtYu1rXLgWwoRem+bP/ybxynKqXNjpBcLFBNtaK+311APwZAgnk9d syczMm5W8zE3atriZzhJVItEvDE96eSwtep350QwHLPtbVVjLKzT7Rr04ralZcDrKG Mdxs7hsE5xLsXdRc8RBlD9lZIrc7pjPpgWFUAKFM= From: ZyX To: Ray Andrews , Zsh Users In-Reply-To: <56575158.1070303@eastlink.ca> References: <56575158.1070303@eastlink.ca> Subject: Re: curiosity with here document. MIME-Version: 1.0 Message-Id: <1330101448564591@web8j.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 26 Nov 2015 22:03:11 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 26.11.2015, 21:38, "Ray Andrews" : > I often comment out blocks of code with here-document, and I just found > this strange thing: > >     /test1 ()/ >     /{/ >     / if [[ "$1" = 'howdy' ]];/ > >     /: <<'COMMENT'/ >     /blah blah >     COMMENT/ > >     / then/ >     / echo stranger/ >     / fi/ >     /}/ > >     /$ test1 no/ >     /stranger/ > > There's no issue if I put the 'then' above the here-document. How should > I understand that? It is as if the here-document is hijacking the 'if' > test and returning true. I'd expect the 'if' to go hunting for it's > 'then' and if it doesn't find it, then throw and error, but not let the > here-document interlope. But if this is proper then it's a caution as > to using these things for commenting. And when writing such questions do read documentation. The specification for `if` looks like if list then list [ elif list then list ] ... [ else list ] fi and using “list” for *both* `if` condition and `then` block should have given you an answer.