From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23643-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=-0.9 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID 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 b6fac2ef for ; Mon, 17 Sep 2018 03:21:07 +0000 (UTC) Received: (qmail 15441 invoked by alias); 17 Sep 2018 03:20:51 -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: 23643 Received: (qmail 21528 invoked by uid 1010); 17 Sep 2018 03:20:50 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf1-f179.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.210.179):SA:0(-1.6/5.0):. Processed in 2.057576 secs); 17 Sep 2018 03:20:50 -0000 X-Envelope-From: lilydjwg@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :disposition-notification-to:user-agent; bh=9FWF7is9gsHg+m273wlFadUF6LQnqPAA/pwSQI5RQVw=; b=s2IY8I+kGhxvM2zvy6gbe+Q4wWyXxF+cKXmf7Sc7QsyFXNSNZKhjC92UnVwGtyINO3 eyc4BhZ0z7fTqp/t2DXzMnBubjJWmI7D9TCOk8KbvaRaTQgZpH6s6an9tCvIoXhVh+jX aUWUzVTApAbaqinlUoMVXhtLedHuxP2EAIjTTka7dhVk3ZTV4kfEn9Nd8Rs2wJusQUbI GKHr54rBS8TzqpKEXl3pZG+d8eEmZ7u94hjnMdywRlTcEaSYNJwBvuBLV/Q5N8Ux4+Ba vcAQmtFhfcmhOSMLlRzPJtol9sTBRGxGLwxHNE+3JWPToNaKho6MvhYNLLzCar3xcddi XAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:disposition-notification-to:user-agent; bh=9FWF7is9gsHg+m273wlFadUF6LQnqPAA/pwSQI5RQVw=; b=e3eZfLjKOiC8TC0d6P9qGW7eSgf9ooqKH+pRDdu3fclVPaKVG57/bxtCdO1Dij9WVi zKjXN6oeoCjzchJu4AbWgCbfWiuddkPn3goRBuSZwNQN6snDml9ujPTWZQ+Zu96jwEbF ddnyNoxL3nkRDJqlE6DEN38DEpghf3U9EUi5Xa7GEJ6L8zgzX44r9mwMEdfkHjIHZj7I bupi1WhUTlq/nTMhPSmCWfo0I2KooVJYB/Z4MZmhorP4CTvWx3672Tcv7Un0iPV+lzw+ XcjhbYHARaQx73eoppeJqdrFXAUxK+CKzEFyF4ZKhkMnUbw5651JAQY1ecRFLfJyQOUX FOpA== X-Gm-Message-State: APzg51D9UGSPxSljoSb3ESTTIRzRVHxuOlNtVgwjKGnPucUelX6NqRQM rmONXtV+KWrcs5b82J6oqs4= X-Google-Smtp-Source: ANB0Vdb+Gb4e1QQ9jC1LT2mk4qnnG0V1F0PHBL2RjzROANdmx/JQKJAnBig3D1Ye/XQxIxKUCUFGYg== X-Received: by 2002:a63:6343:: with SMTP id x64-v6mr21888083pgb.173.1537154446055; Sun, 16 Sep 2018 20:20:46 -0700 (PDT) Date: Mon, 17 Sep 2018 11:20:11 +0800 From: lilydjwg To: Daniel Shahaf Cc: zsh-users@zsh.org Subject: Re: test for newline in a variable--unexpected results sometimes Message-ID: <20180917032009.GA5537@lilyforest.localdomain> References: <20180916172716.GA27892@lilyforest.localdomain> <20180916204433.6k36inmuekgqp3a2@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180916204433.6k36inmuekgqp3a2@tarpaulin.shahaf.local2> User-Agent: Mutt/1.10.1 (2018-07-13) On Sun, Sep 16, 2018 at 08:44:33PM +0000, Daniel Shahaf wrote: > In this context, «\n» does not mean a newline; it means either the letter 'n', > or the two-character sequence «\n», but I don't remember which. Thanks! Problem solved. > > cmd2="cd \ncd /sys/class/leds" > > Ditto.. If you try «xxd <<<$cmd2» you'll see the variable's value contains the > two-character sequence «\n». I echoed it, and it turns out that echo itself turned all \n into real newlines. -- Best regards, lilydjwg