This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: echo -e


Ulrich Drepper <drepper@redhat.com> wrote:
> Maybe all this means using printf instead of echo.

printf seems to behave the same way for bash, pdksh, NetBSD, FreeBSD,
OpenBSD, and Solaris.  Here's a patch which I'm now testing.

	* csu/Makefile: Use printf for consistent backslash handling.

Index: csu/Makefile
===================================================================
RCS file: /cvs/glibc/libc/csu/Makefile,v
retrieving revision 1.73
diff -u -r1.73 Makefile
--- csu/Makefile	8 Mar 2004 21:28:15 -0000	1.73
+++ csu/Makefile	17 Aug 2004 22:00:23 -0000
@@ -216,7 +216,7 @@
 $(objpfx)version-info.h: $(common-objpfx)config.make $(all-Banner-files)
 	$(make-target-directory)
 	(case $(config-os) in \
-	   linux*) version=`(echo -e "#include <linux/version.h>\nUTS_RELEASE"\
+	   linux*) version=`(printf "#include <linux/version.h>\nUTS_RELEASE"\
 			     | $(CC) $(CPPFLAGS) -E -P - -DNOT_IN_libc=1 | \
 			     sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\
 		   if [ -z "$$version" ]; then \
@@ -231,13 +231,13 @@
 		   if [ -z "$$os" ]; then \
 		     os=Linux; \
 		   fi; \
-		   echo "\"Compiled on a $$os $$version system" \
-			"on `date +%Y-%m-%d`.\\n\"" ;; \
+		   printf "\"Compiled on a %s.\\\\n\"" \
+		     "$$os $$version system on `date +%Y-%m-%d`" ;; \
 	   *) ;; \
 	 esac; \
 	 files="$(all-Banner-files)";				\
 	 if test -n "$$files"; then				\
-	   echo "\"Available extensions:\\n\"";			\
+	   printf "\"Available extensions:\\\\n\"";		\
 	   sed -e '/^#/d' -e 's/^[[:space:]]*/	/'		\
 	       -e 's/^\(.*\)$$/\"\1\\n\"/' $$files;		\
 	 fi) > $@T


paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]