[PATCH 3/4] Delete newline after processing with sed

Michael Forney mforney at mforney.org
Sun Apr 26 09:24:21 AEST 2020


sed requires that the inputs are text files, and POSIX defines a
text file as zero or more lines, each with a trailing newline.

Some implementations of sed will always print a newline after the
line, even if it didn't originally have one, causing an extra blank
line when the newline is re-added below.
---
 regress/unittests/sshkey/mktestdata.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/regress/unittests/sshkey/mktestdata.sh b/regress/unittests/sshkey/mktestdata.sh
index 05425ec8..4969061d 100755
--- a/regress/unittests/sshkey/mktestdata.sh
+++ b/regress/unittests/sshkey/mktestdata.sh
@@ -56,8 +56,8 @@ ecdsa_params() {
 	    awk '/^pub:/,/^ASN1 OID:/' | #\
 	    grep -v '^[a-zA-Z]' | tr -d ' \n:' > ${_outbase}.pub
 	openssl ec -noout -text -in $_in | \
-	    grep "ASN1 OID:" | tr -d '\n' | \
-	    sed 's/.*: //;s/ *$//' > ${_outbase}.curve
+	    grep "ASN1 OID:" | \
+	    sed 's/.*: //;s/ *$//' | tr -d '\n' > ${_outbase}.curve
 	for x in priv pub curve ; do
 		echo "" >> ${_outbase}.$x
 		echo ============ ${_outbase}.$x
-- 
2.26.2



More information about the openssh-unix-dev mailing list