From mboxrd@z Thu Jan 1 00:00:00 1970 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=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 9196 invoked from network); 16 Apr 2020 21:06:56 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 16 Apr 2020 21:06:56 -0000 Received: (qmail 29786 invoked by alias); 16 Apr 2020 21:06:49 -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: 24787 Received: (qmail 5115 invoked by uid 1010); 16 Apr 2020 21:06:49 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f49.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25779. spamassassin: 3.4.4. Clear:RC:0(209.85.166.49):SA:0(-2.0/5.0):. Processed in 2.244431 secs); 16 Apr 2020 21:06:49 -0000 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.49 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=vuwSic8m1tzD9dt3f3WbK+UEjwsA9kfgyXD3S+rc0cY=; b=A2120/ni3qSDGyawjA/psMZpFCSWXFvnWo50jU6ZuQtfJN0+DiHwXRnxOZyKVryUJY A0TFaX1wScdAouRNrtmzo/2QvvZ8kEtoHlrtLMhhX7hs18uS8ZN+IewfRkRQ+W5mHjdr wROmgYozOzUdvb1dPsQj/3D4CShlTPTViY2sKamD7xmN6ch1naxAd0Zoyf5PMm9Hbtwg lPuXzq3UsEfcHmX1ednfa7Ki6AqnerhZWh0tAcDRLx6rhd2cD0uyJlIJuhzv5Wa21ph9 mgbr2wLFAL4t8/aQfd8BvF+5+HH05QfBuIRqSLS2ES6EVp5a+mWab8hhs1adXoxwK48y Ad2Q== X-Gm-Message-State: AGi0PuZ4azg7PUTd9LnRSeDG3VzIDcFOr/UYxeOvq6AfQo0cJt9jNHyc caYBKoCRZm+jQSuIOuTZPGaIEABKr8mEXtwtIq4= X-Google-Smtp-Source: APiQypL+T3Rx/XLbxNm6IEsQ9oJGvVyomRnwMo5CfgdFfAgUeC/a005SKrmSnIVxxKI9yHVdu8OLbcYOIKVikdqiUGc= X-Received: by 2002:a05:6602:5db:: with SMTP id w27mr21375372iox.152.1587071174069; Thu, 16 Apr 2020 14:06:14 -0700 (PDT) MIME-Version: 1.0 References: <20200416202451.gb5ft5f7mrpre6bf@chazelas.org> In-Reply-To: <20200416202451.gb5ft5f7mrpre6bf@chazelas.org> From: Pier Paolo Grassi Date: Thu, 16 Apr 2020 23:06:03 +0200 Message-ID: Subject: Re: read -r and bad surprises (Was: indirect assignment to array) To: Mikael Magnusson , Pier Paolo Grassi , Sebastian Gniazdowski , Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000090742905a36ecd06" --00000000000090742905a36ecd06 Content-Type: text/plain; charset="UTF-8" thanks, fortunately I already crossed that bridge, as my read alias can testify: alias \read read='IFS='''' read -r' Pier Paolo Grassi linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217 founder: https://www.meetup.com/it-IT/Machine-Learning-TO Il giorno gio 16 apr 2020 alle ore 22:24 Stephane Chazelas < stephane@chazelas.org> ha scritto: > 2020-04-16 20:04:57 +0200, Pier Paolo Grassi: > [...] > > thanks but I really hate when I find out bugs that i never have thought > of > > (a big one has been discovering the -r flag to read) > [...] > > While you're there, note that the syntax to read a line of input > verbatim is: > > IFS= read -r line > > not just read -r line. > > Compare: > > $ print -r ' a\b ' | IFS= read -r a; printf '<%s>\n' $a > < a\b > > $ print -r ' a\b ' | read -r a; printf '<%s>\n' $a > > $ print -r ' a\b ' | read a; printf '<%s>\n' $a > > > See > https://unix.stackexchange.com/questions/209123/understanding-ifs-read-r-line > for details. > > -- > Stephane > -- Pier Paolo Grassi --00000000000090742905a36ecd06--