diff mbox

[8/8] dim: abstract -i interactive pause to a function

Message ID 5f408e3d7866def7ac6dc74562c978c338c4e670.1490091134.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula March 21, 2017, 10:14 a.m. UTC
Fixes shellcheck SC2089: Quotes/backslashes will be treated
literally. Use an array.

Fixes shellcheck SC2090: Quotes/backslashes in this variable will not be
respected.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 Makefile | 2 --
 dim      | 8 +++++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 78087f669221..1f628e9489f9 100644
--- a/Makefile
+++ b/Makefile
@@ -24,8 +24,6 @@  SC_EXCLUDE := \
 	-e SC2034 \
 	-e SC2046 \
 	-e SC2086 \
-	-e SC2089 \
-	-e SC2090 \
 	-e SC2119 \
 	-e SC2120 \
 	-e SC2143
diff --git a/dim b/dim
index 53221de9171c..702df1d69988 100755
--- a/dim
+++ b/dim
@@ -139,6 +139,12 @@  function warn_or_fail
 	fi
 }
 
+function pause
+{
+	read -rsp "Press any key to continue..." -n1 key2
+	echo
+}
+
 while getopts hdfi opt; do
 	case "$opt" in
 		d)
@@ -149,7 +155,7 @@  while getopts hdfi opt; do
 			FORCE=1
 			;;
 		i)
-			INTERACTIVE='eval read -rsp "Press any key to continue..." -n1 key2; echo'
+			INTERACTIVE=pause
 			;;
 		h)
 			HELP=1