Date: Thu, 18 Jul 2002 22:10:35 -0400 (EDT) From: Eric van Gyzen <esv@vangyzen.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/40747: sh(1) does not honor -e and -n concurrently Message-ID: <200207190210.g6J2AZx8003921@trillian.vangyzen.net>
next in thread | raw e-mail | index | archive | help
>Number: 40747
>Category: bin
>Synopsis: sh(1) does not honor -e and -n concurrently
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Jul 18 19:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Eric van Gyzen
>Release: FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD trillian.vangyzen.net 4.6-STABLE FreeBSD 4.6-STABLE #3: Sun Jul 14 19:03:47 EDT 2002 vangyzen@trillian.vangyzen.net:/build/src/sys/compile/TRILLIAN i386
>Description:
The sh(1) manpage claims that the "echo" builtin command accepts
any combination of the -e and -n flags, but it actually accepts
only one flag per invocation.
>How-To-Repeat:
The following sh(1) command does not behave as documented:
$ echo -en "\033]0;${HOST}\007"
>Fix:
Following patch allows "-en" and "-ne" combinations.
A more extensive patch to allow "-e -n" or "-n -e"
is left as an exercise for the reader.
--- bin/sh/bltin/echo.c.orig Thu Jul 18 21:39:13 2002
+++ bin/sh/bltin/echo.c Thu Jul 18 21:40:22 2002
@@ -73,6 +73,12 @@
eflag++;
#endif
ap++;
+ } else if (equal(p, "-ne") || equal(p, "-en")) {
+#ifndef eflag
+ eflag++;
+#endif
+ nflag++;
+ ap++;
}
}
while ((p = *ap++) != NULL) {
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207190210.g6J2AZx8003921>
