From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23638-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id df303b0c for ; Sun, 16 Sep 2018 20:54:13 +0000 (UTC) Received: (qmail 24213 invoked by alias); 16 Sep 2018 20:54:01 -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: List-Unsubscribe: X-Seq: 23638 Received: (qmail 11542 invoked by uid 1010); 16 Sep 2018 20:54:00 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f48.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.214.48):SA:0(-1.9/5.0):. Processed in 2.395697 secs); 16 Sep 2018 20:54:00 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=U7z5sihEx15Bel2N8/8TI4kov+IpbRBDO3OV4jJ6Hl0=; b=xcU5WwFewv8WepzyUBRBPuMLSlTHpKGeBVo4JJWWIfdkcRVx7E2LK1evix0lSNOKHk cc1xcR/DFaoHm3LIN0+F7a24DC+DFxFJeGNLtYpOqESDsFl4r1kY+iCsXuiEXml2U8dy eMQrX16bvu3PYJIqrzY6E/mGNxADc0QfWnVBbCxG4L/0/QTLG8tkRxjUycqI/dvT+2rk apgZSpRaSCKweYR4i6WO6WRbmB3IgmqrTXIDr13gv4AwM6F5DUfMatFU4QIHCSGPCT45 j5psttpZ8giTqwTxE/EPguKqVT8ti7qkunYtCGASVqZBRb5ajkhF/FFCmIVZ48gdd8Qm QbJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=U7z5sihEx15Bel2N8/8TI4kov+IpbRBDO3OV4jJ6Hl0=; b=ldhhpThfrSZOb7oJlm9lxjeeGzNBR+lCBsexF8mn9gNY8oGskwt7EUAZtee4P65E1v ohktPU+2nHP0bQvjQAOqno2rf4cDHxqUk5JspMEzBg7EoXAsh5uYDNo/L6w/EC2U36wL LaIdK3a8KDHInHiH5Pmkd/gq5qkvDGd+zqlL0w3ZOPThBCHLuCJQAJxvfnj+kcMMjO/b KBaxwAgRlM1g88rZNCGc9kYBCTLydmCQczSsL8nixhJce18jhHRL2PcWWuK/Lv2N2wWh odv5/tlA8bfZfAytr3y1DeIL/AHeTcynnac+OnajErK+PM5qVWmR8Fg9nY0iVOl3/aYL /E9Q== X-Gm-Message-State: APzg51B1tlmihUaUOZNtU2YaEZG0PEcqMwLN8LsmV7JUt1S+4pfPwF2t F4crH+ssPC3MDdBEdGHL1Egb2vZnFjABQw== X-Google-Smtp-Source: ANB0VdaYpO8DT0Cd7cDA4yRkAuHA6auF+CzP/gaK6S2omIDNOowQ/E7OZluEK7NDq5BaOvGJp9roiA== X-Received: by 2002:a24:dd88:: with SMTP id t130-v6mr9533875itf.129.1537131235598; Sun, 16 Sep 2018 13:53:55 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: test for newline in a variable--unexpected results sometimes From: dana In-Reply-To: <20180916204433.6k36inmuekgqp3a2@tarpaulin.shahaf.local2> Date: Sun, 16 Sep 2018 15:53:54 -0500 Cc: lilydjwg , zsh-users@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180916172716.GA27892@lilyforest.localdomain> <20180916204433.6k36inmuekgqp3a2@tarpaulin.shahaf.local2> To: Daniel Shahaf X-Mailer: Apple Mail (2.3445.8.2) On 16 Sep 2018, at 15:44, Daniel Shahaf wrote: >In this context, =C2=AB\n=C2=BB does not mean a newline; it means = either the letter 'n', >or the two-character sequence =C2=AB\n=C2=BB, but I don't remember = which. I was about to hit send on an answer to this but you addressed it. = Here's a more detailed explanation of this part (the effects of quoting): * In an UNQUOTED string, all slash-escaped characters produce the = literal version of the character being escaped: \\ -> \ \$ -> $ \1 -> 1 \n -> n * In a DOUBLE-QUOTED string, slash-escaped shell meta-characters produce = the literal version of the character being escaped. Any other back-slash = is left as-is: "\\" -> \ "\$" -> $ "\1" -> \1 "\n" -> \n * In a SINGLE-QUOTED string, all back-slashes are left as-is: '\\' -> \\ '\$' -> \$ '\1' -> \1 '\n' -> \n * In a DOLLAR-QUOTED string, escape sequences are interpreted according = to the default behaviour of the print built-in, which supports various = C-style sequences amongst other things. Sequences that aren't handled = specifically are treated as they are in unquoted strings: $'\\' -> \ $'\$' -> $ $'\1' -> (ASCII character with octal code point 001) $'\n' -> (ASCII new-line) This is mostly covered by the Shell Grammar section of the manual, = though it's not quite as explicit dana