Debian Bug report logs - #593237
dash built-in echo expands \nnn sequences

version graph

Package: dash; Maintainer for dash is Andrej Shadura <[email protected]>; Source for dash is src:dash (PTS, buildd, popcon).

Reported by: "Alexander E. Patrakov" <[email protected]>

Date: Mon, 16 Aug 2010 14:42:01 UTC

Severity: wishlist

Tags: upstream, wontfix

Merged with 538100, 550399, 599834, 652509, 698593

Found in versions 0.5.5.1-7.4ubuntu1, dash/0.5.4-12, dash/0.5.5.1-2, dash/0.5.5.1-6, dash/0.5.5.1-7.4

Full log


Message #12 received at [email protected] (full text, mbox, reply):

Received: (at control) by bugs.debian.org; 16 Aug 2010 20:32:39 +0000
From [email protected] Mon Aug 16 20:32:39 2010
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on busoni.debian.org
X-Spam-Level: 
X-Spam-Bayes: score:0.0000 Tokens: new, 13; hammy, 112; neutral, 43; spammy,
	1. spammytokens:0.853-+--pain hammytokens:0.000-+--forcemerge,
	0.000-+--H*u:1.5.20, 0.000-+--H*UA:1.5.20, 0.000-+--H*u:2009-06-14,
	0.000-+--H*UA:2009-06-14
X-Spam-Status: No, score=-4.5 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	SPF_PASS,URIBL_CNKR autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Return-path: <[email protected]>
Received: from mail-qw0-f52.google.com ([209.85.216.52])
	by busoni.debian.org with esmtp (Exim 4.69)
	(envelope-from <[email protected]>)
	id 1Ol6MI-0002FR-LD; Mon, 16 Aug 2010 20:32:39 +0000
Received: by qwj8 with SMTP id 8so7213592qwj.11
        for <multiple recipients>; Mon, 16 Aug 2010 13:32:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:date:from:to:cc:subject
         :message-id:references:mime-version:content-type:content-disposition
         :in-reply-to:user-agent;
        bh=S1ik/E7aJV9rdZzRl1W/12ZUkMDhzTqCvoStmDQAFdw=;
        b=Qx1DL1mdSVVC0tQKFbFb5xrszIdqhPq+Ziqy/vC5UduPYT1vnZz75unbGXK4q55rE9
         NZB0HXRdSyCo1cV9xDz4iY1ATLRgQX38c6jggrRcSujbxozo9i3eigR3/KeH90MxfYm2
         cHiiTzh70snueFqJXJ8UAXcX4Js/4BFGSF1JE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=date:from:to:cc:subject:message-id:references:mime-version
         :content-type:content-disposition:in-reply-to:user-agent;
        b=wulLNZBbvfTcAkZDTxVduhZ2rXn379S9kVG91vhyUfRYZqpiz0rCiiOtff1Z5qKQRU
         spfFsBTW/k2Ubxz6Pn1LwVy7QPGPNt92mx4onHLmermyIca7DoxX9kfRZRrYJv1j4ZCG
         LaL80s3KTUsdRAxc/9deLozubZ+2AtMrq9RqU=
Received: by 10.229.184.13 with SMTP id ci13mr4103262qcb.142.1281990752119;
        Mon, 16 Aug 2010 13:32:32 -0700 (PDT)
Received: from burratino (dhcp-11-17.cs.uchicago.edu [128.135.11.176])
        by mx.google.com with ESMTPS id t4sm7763443qcs.28.2010.08.16.13.32.29
        (version=SSLv3 cipher=RC4-MD5);
        Mon, 16 Aug 2010 13:32:31 -0700 (PDT)
Date: Mon, 16 Aug 2010 15:30:35 -0500
From: Jonathan Nieder <[email protected]>
To: "Alexander E. Patrakov" <[email protected]>
Cc: [email protected]
Subject: Re: Bug#593237: dash: Can't echo \b
Message-ID: <20100816203035.GA2269@burratino>
References: <1281969537.2108.1.camel@patrakov-desktop>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1281969537.2108.1.camel@patrakov-desktop>
User-Agent: Mutt/1.5.20 (2009-06-14)
Delivered-To: [email protected]
forcemerge 550399 593237
quit

Hi,

Alexander E. Patrakov wrote:

> There seems to be no way to produce the sequence "\b" (that's
> backslash, then the letter b) using dash's builtin echo. Bash
> and /bin/echo work fine. I have tried the following commands in my
> shell script:
> 
> echo "\b"
> echo '\b'
> 
> ...but they only produce a backspace character (0x08) even though
> I have not passed the -e switch.

Indeed, echo is not guaranteed to do that[1].  The Almquist shell that
dash is based on never supported the -e switch.  Changing this
historical behavior would be a big pain.

Portable shell scripts should use

	printf '%s\n' '\b'

and unportable scripts should use

	#!/bin/bash

or similar.

Hope that helps,
Jonathan

[1] http://www.opengroup.org/onlinepubs/9699919799/utilities/echo.html




Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 14:21:27 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.