From f69495ea7134b9c965088273987e2c382565189e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 17 Dec 2016 10:36:00 +0000 Subject: [PATCH] Use printf instead of echo for displaying modified lines Avoid eventual interpretation of escapes in the line. --- test/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/run b/test/run index a742ff36..9f805f8d 100755 --- a/test/run +++ b/test/run @@ -149,14 +149,14 @@ colorize() { show_diff() { diff -u $1 $2 | while IFS='' read -r line; do - first_character=$(echo "$line" | cut -b 1) + first_character=$(printf '%s\n' "$line" | cut -b 1) case $first_character in +) color=green ;; -) color=red ;; @) color=magenta ;; *) color=none ;; esac - echo "$line" | colorize $color normal + printf '%s\n' "$line" | colorize $color normal done }