public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] docparse/parse.sh: Fix parsing on dash
Date: Thu, 17 Dec 2020 13:15:19 +0100	[thread overview]
Message-ID: <20201217121520.25713-2-pvorel@suse.cz> (raw)
In-Reply-To: <20201217121520.25713-1-pvorel@suse.cz>

bash keeps escape sequences (e.g. \t and \n) when using echo:

$ a="-v\tverbose output\n"; echo "$a"
-v\tverbose output\n
$

But dash interprets them (behaves like echo -e on bash):

$ a="-v\tverbose output\n"; echo -e "$a"
-e -v	verbose output

$

Using printf does not help, because it'd have to be separated with --
which cannot be used for printing variables.
Fortunately cat << EOF redirection is portable.
In the future we should probably avoid shell as much as possible.

Fixes: 0962c9a37 ("syscalls/perf_event_open02: Use anonymous .options")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 docparse/parse.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docparse/parse.sh b/docparse/parse.sh
index 4ae0c42b2..172eab702 100755
--- a/docparse/parse.sh
+++ b/docparse/parse.sh
@@ -32,7 +32,9 @@ for test in `find testcases/ -name '*.c'`; do
 			echo ','
 		fi
 		first=
-		echo -n "$a"
+		cat <<EOF
+$a
+EOF
 	fi
 done
 
-- 
2.29.2


  reply	other threads:[~2020-12-17 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 12:15 [LTP] [PATCH 0/2] Travis build fixes Petr Vorel
2020-12-17 12:15 ` Petr Vorel [this message]
2020-12-17 12:20   ` [LTP] [PATCH 1/2] docparse/parse.sh: Fix parsing on dash Cyril Hrubis
2020-12-17 12:36     ` Petr Vorel
2020-12-17 12:58     ` Petr Vorel
2020-12-17 12:15 ` [LTP] [PATCH 2/2] docparse/parse.sh: Fix running with relative path Petr Vorel
2020-12-17 12:22   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201217121520.25713-2-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox