Commit 67d7451ca0b909687a2689243077b8d7edb65102

Christian Weisgerber 2021-09-15T08:29:53

shell code fixes Escape sequences are not handled by every echo(1), e.g. not on FreeBSD. '?' is a glob character and must be quoted. '!' is not a shell meta character. ok tracey stsp

diff --git a/regress/cmdline/checkout.sh b/regress/cmdline/checkout.sh
index 7e75429..14a2541 100755
--- a/regress/cmdline/checkout.sh
+++ b/regress/cmdline/checkout.sh
@@ -821,7 +821,7 @@ test_checkout_quiet() {
 
 	echo -n "Checked out refs/heads/master: " >> $testroot/stdout.expected
 	git_show_head $testroot/repo >> $testroot/stdout.expected
-	echo "\nNow shut up and hack" >> $testroot/stdout.expected
+	printf "\nNow shut up and hack\n" >> $testroot/stdout.expected
 
 	got checkout -q $testroot/repo $testroot/wt > $testroot/stdout
 	ret="$?"
diff --git a/regress/cmdline/status.sh b/regress/cmdline/status.sh
index 47f3fb7..de94a6e 100755
--- a/regress/cmdline/status.sh
+++ b/regress/cmdline/status.sh
@@ -746,7 +746,7 @@ test_status_status_code() {
 
 	echo '!  epsilon/zeta' > $testroot/stdout.expected
 	echo '?  foo' >> $testroot/stdout.expected
-	(cd $testroot/wt && got status -s \!? > $testroot/stdout)
+	(cd $testroot/wt && got status -s !\? > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -878,7 +878,7 @@ test_status_suppress() {
 	fi
 
 	echo 'M  alpha' > $testroot/stdout.expected
-	(cd $testroot/wt && got status -S D?A\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S D\?A! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -888,7 +888,7 @@ test_status_suppress() {
 	fi
 
 	echo 'D  beta' > $testroot/stdout.expected
-	(cd $testroot/wt && got status -S M?A\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S M\?A! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -909,7 +909,7 @@ test_status_suppress() {
 	fi
 
 	echo 'A  new' > $testroot/stdout.expected
-	(cd $testroot/wt && got status -S MD?\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -921,7 +921,7 @@ test_status_suppress() {
 	(cd $testroot/wt && got stage new > $testroot/stdout)
 
 	echo ' A new' > $testroot/stdout.expected
-	(cd $testroot/wt && got status -S MD?\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -934,7 +934,7 @@ test_status_suppress() {
 
 	echo 'M  alpha' > $testroot/stdout.expected
 	echo 'MA new' >> $testroot/stdout.expected
-	(cd $testroot/wt && got status -S D?\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S D\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -944,7 +944,7 @@ test_status_suppress() {
 	fi
 
 	echo 'M  alpha' > $testroot/stdout.expected
-	(cd $testroot/wt && got status -S AD?\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S AD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -956,7 +956,7 @@ test_status_suppress() {
 	rm $testroot/stdout.expected
 	touch $testroot/stdout.expected
 
-	(cd $testroot/wt && got status -S MD?\! > $testroot/stdout)
+	(cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then