Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Apr 2016 16:06:13 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297752 - head/bin/sh/tests/builtins
Message-ID:  <201604091606.u39G6DJg018682@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Apr  9 16:06:13 2016
New Revision: 297752
URL: https://svnweb.freebsd.org/changeset/base/297752

Log:
  sh: Fix some unquoted variables in tests.
  
  The builtins/getopts1.0 test failed if a single-character file existed in
  the current directory.

Modified:
  head/bin/sh/tests/builtins/getopts1.0
  head/bin/sh/tests/builtins/getopts2.0
  head/bin/sh/tests/builtins/getopts9.0

Modified: head/bin/sh/tests/builtins/getopts1.0
==============================================================================
--- head/bin/sh/tests/builtins/getopts1.0	Sat Apr  9 14:50:47 2016	(r297751)
+++ head/bin/sh/tests/builtins/getopts1.0	Sat Apr  9 16:06:13 2016	(r297752)
@@ -3,7 +3,7 @@
 printf -- '-1-\n'
 set -- -abc
 getopts "ab:" OPTION
-echo ${OPTION}
+printf '%s\n' "${OPTION}"
 
 # In this case 'getopts' should realize that we have not provided the
 # required argument for "-b".
@@ -14,12 +14,12 @@ echo ${OPTION}
 printf -- '-2-\n'
 set -- -ab
 getopts "ab:" OPTION
-echo ${OPTION}
+printf '%s\n' "${OPTION}"
 getopts "ab:" OPTION 3>&2 2>&1 >&3 3>&-
-echo ${OPTION}
+printf '%s\n' "${OPTION}"
 
 # The 'shift' is aimed at causing an error.
 printf -- '-3-\n'
 shift 1
 getopts "ab:" OPTION
-echo ${OPTION}
+printf '%s\n' "${OPTION}"

Modified: head/bin/sh/tests/builtins/getopts2.0
==============================================================================
--- head/bin/sh/tests/builtins/getopts2.0	Sat Apr  9 14:50:47 2016	(r297751)
+++ head/bin/sh/tests/builtins/getopts2.0	Sat Apr  9 16:06:13 2016	(r297752)
@@ -3,4 +3,4 @@ set - -ax
 getopts ax option
 set -C
 getopts ax option
-echo $option
+printf '%s\n' "$option"

Modified: head/bin/sh/tests/builtins/getopts9.0
==============================================================================
--- head/bin/sh/tests/builtins/getopts9.0	Sat Apr  9 14:50:47 2016	(r297751)
+++ head/bin/sh/tests/builtins/getopts9.0	Sat Apr  9 16:06:13 2016	(r297752)
@@ -2,8 +2,8 @@
 
 args='-ab'
 getopts ab opt $args
-echo $?:$opt:$OPTARG
+printf '%s\n' "$?:$opt:$OPTARG"
 for dummy in dummy1 dummy2; do
 	getopts ab opt $args
-	echo $?:$opt:$OPTARG
+	printf '%s\n' "$?:$opt:$OPTARG"
 done



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604091606.u39G6DJg018682>