bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: using printf with \e for ESC isn't portable


From: Jim Meyering
Subject: [PATCH] tests: using printf with \e for ESC isn't portable
Date: Wed, 25 Feb 2009 19:55:11 +0100

Using \e is fine in Perl, but not with printf(1).

>From 1d4a2bf229786996390b5fb855b82e6deb95953e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 25 Feb 2009 19:51:04 +0100
Subject: [PATCH] tests: using printf with \e for ESC isn't portable

* tests/ls/color-clear-to-eol: Use \x1b, not \e for ascii ESC.
This test failed when using the built-in printf of NetBSD's /bin/sh.
---
 tests/ls/color-clear-to-eol |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/ls/color-clear-to-eol b/tests/ls/color-clear-to-eol
index ff9530d..2e75282 100755
--- a/tests/ls/color-clear-to-eol
+++ b/tests/ls/color-clear-to-eol
@@ -26,9 +26,10 @@ fi
 long_name=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo
 touch $long_name || framework_failure

+e='\x1b'
 color_code='0;31;42'
-c_pre='\e[0m\e['"${color_code}m"
-c_post='\e[0m\e[K\n\e[m'
+c_pre="$e[0m$e[${color_code}m"
+c_post="$e[0m$e[K\n$e[m"
 printf "$c_pre$long_name$c_post" > exp || framework_failure

 fail=0
--
1.6.2.rc1.285.gc5f54




reply via email to

[Prev in Thread] Current Thread [Next in Thread]