From owner-freebsd-bugs Tue Nov 6 10:10:12 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 11FB437B418 for ; Tue, 6 Nov 2001 10:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fA6IA2F68366; Tue, 6 Nov 2001 10:10:02 -0800 (PST) (envelope-from gnats) Date: Tue, 6 Nov 2001 10:10:02 -0800 (PST) Message-Id: <200111061810.fA6IA2F68366@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Eugene Grosbein Subject: Re: bin/31627 sh(1) is broken - loss of data! Reply-To: Eugene Grosbein Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/31627; it has been noted by GNATS. From: Eugene Grosbein To: Thomas Quinot Cc: Eugene Grosbein , stable@freebsd.org, freebsd-gnats-submit@freebsd.org Subject: Re: bin/31627 sh(1) is broken - loss of data! Date: Wed, 7 Nov 2001 01:00:20 +0700 On Tue, Nov 06, 2001 at 06:18:34PM +0100, Thomas Quinot wrote: > > #!/bin/sh > > string=`printf "\21"` > > echo $string | hd > > > Replace 21 with 201 and rerun. You see: > > 00000000 0a |.| > > 00000001 > > Can't reproduce here for the value \201, but for the other values > you mention it looks like perfectly normal and expected behaviour > from sh(1). It is not surprising at all that some characters "disappear" > here: since $string appears unquoted, any character which is whitespace > w.r.t. shell parsing rules won't be passed to echo. > Try to quote your string: > echo "$string" | hd I still get unexpected results: #!/bin/sh string=`printf "\210"` echo "$string" | hd gives me: 00000000 0a |.| 00000001 The same with \12 and \201. Other codes are Ok, thank you for explanation. I see that \12 is removed by backquotes but wonder what with \201 and \210. Eugene Grosbein To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message