From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26802 invoked by alias); 10 Sep 2017 16:59:50 -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: 22885 Received: (qmail 7999 invoked by uid 1010); 10 Sep 2017 16:59:50 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-9.server.virginmedia.net 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(80.0.253.73):SA:0(-4.7/5.0):. Processed in 1.365602 secs); 10 Sep 2017 16:59:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Originating-IP: [86.21.219.59] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.1 cv=aJkN0uJm c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=x7bEGLp0ZPQA:10 a=jKjxfLc-AAAA:8 a=pEAmzqaIZAjqav3PAU0A:9 a=CjuIK1q_8ugA:10 Date: Sun, 10 Sep 2017 17:59:43 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: string overwrites string when echoed Message-ID: <20170910175943.77a8313a@ntlworld.com> In-Reply-To: <86shfumrzm.fsf@zoho.com> References: <86o9qkqbes.fsf@zoho.com> <170909100149.ZM8451@torch.brasslantern.com> <86shfumrzm.fsf@zoho.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1505062784; bh=oVPfy00yK7BQTnwVatFVuAS2Zmy4Yb3efNdTpb0Fq9w=; h=Date:From:To:Subject:In-Reply-To:References; b=REuUPRZ67AUZCRelIIloog8Sgyq3oY4NQtdDYX990nj3GIBBVY9nVEc5ztHzsM51l Zn1Van2V/aKC4xiShvyWwP/uyUtNLVtQdjG95WvqkfDnWpuFGkpgNh1J4U6XvB4NM7 FMeozPJPeHbyrHmfbeq5IuMYNZ1dXw+HPj01cpSW8jkET8qfF0Qc5PSNhLKp5TEMwf t+YjML/vFwCi7CZeT6uihsSmEHZJgH5ssbPGMYo0rOEM6uT6fhXEpLYOG8u0RZ/VrP tnfFUKeBxULxyEAmvp1MA9f92OI075ViGsNk0HCHsVFZ4OMdeb2hoZNVC89jFR4XA0 5BbudkHwnsi0g== On Sun, 10 Sep 2017 18:35:25 +0200 Emanuel Berg wrote: > Bart Schaefer wrote: > > > The value of $reply has an embedded > > carriage-return. You can see this if you use: > > > > echo "$u ${(V)reply}" echo "${(V)reply} $u" > > echo "${(V)reply} $u" works, only how do I drop > the ^M then? Replacing $reply with ${reply%%$'\r'} would do the trick. There may be something you can do with stty, but that's a bit out of the scope of the shell (or indeed sanity :-(). pws