summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-12 22:14:20 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-12 22:14:20 (EDT)
commit33bbc2affa91f5ec62c8275be62a3a0da51ae2a9 (patch)
tree8bcc8954f1d78d6d0b555b48bd1a85cfcb57af70
parent11a61d2a7083cc87c714228fecac23d74b45f6c4 (diff)
ob_get_binary_packages(), _ob_set_binary_parameter(): Replace echo and grep with case
-rw-r--r--lib/package.sh19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/package.sh b/lib/package.sh
index 24a6d01..bf21399 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -182,14 +182,12 @@ ob_get_binary_packages()
"${pkg}"
EOF
)"
- if echo "${pkgs_clean}" | grep " ${pkg_clean} " \
- >/dev/null 2>&1; then
+ case "${pkgs_clean}" in *" ${pkg_clean} "*)
_ob_warn_msg 'duplicate_clean_binary_name' \
"${pkg_clean}"
continue
- else
- pkgs_clean="${pkgs_clean}${pkg_clean} "
- fi
+ esac
+ pkgs_clean="${pkgs_clean}${pkg_clean} "
pkgs="${pkgs} ${pkg}"
@@ -409,10 +407,13 @@ _ob_set_binary_parameter()
EOF
)"
- if ! echo " ${_OB_BINARY_PARAMETERS} " | grep " ${name} " \
- >/dev/null 2>&1; then
- _OB_BINARY_PARAMETERS="${_OB_BINARY_PARAMETERS} ${name}"
- fi
+ case " ${_OB_BINARY_PARAMETERS} " in
+ *" ${name} "*)
+ ;;
+ *)
+ _OB_BINARY_PARAMETERS="${_OB_BINARY_PARAMETERS} ${name}"
+ ;;
+ esac
eval "_OB_BINFIELD_${package}_${name}=\"\${value}\""