Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 7b48751

Browse files
committed
Merge pull request #1 from imdjh/master
Use grep -q option instead of redirecting to /dev/null
2 parents 8104d9b + 95f53b7 commit 7b48751

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

hyper-bootstrap-xen.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ check_deps_distro() {
147147
if [ "${LSB_DISTRO}" == "linuxmint" ]
148148
then SUPPORT_CODE_LIST="${LINUX_MINT_CODE[@]}";
149149
fi
150-
if (echo "${SUPPORT_CODE_LIST}" | grep -v -w "${LSB_CODE}" &>/dev/null);then
150+
if (echo "${SUPPORT_CODE_LIST}" | grep -vqw "${LSB_CODE}");then
151151
show_message error "Hyper support ${LSB_DISTRO}( ${SUPPORT_CODE_LIST} ), but current is ${LSB_CODE}(${LSB_VER})"
152152
exit ${ERR_NOT_SUPPORT_DISTRO_VERSION[0]}
153153
fi
@@ -157,7 +157,7 @@ check_deps_distro() {
157157
then SUPPORT_CODE_LIST="${UBUNTU_CODE[@]}";
158158
else SUPPORT_CODE_LIST="${DEBIAN_CODE[@]}";
159159
fi
160-
if (echo "${SUPPORT_CODE_LIST}" | grep -v -w "${LSB_CODE}" &>/dev/null);then
160+
if (echo "${SUPPORT_CODE_LIST}" | grep -vqw "${LSB_CODE}");then
161161
show_message error "Hyper support ${LSB_DISTRO}( ${SUPPORT_CODE_LIST} ), but current is ${LSB_CODE}(${LSB_VER})"
162162
exit ${ERR_NOT_SUPPORT_DISTRO_VERSION[0]}
163163
fi
@@ -168,7 +168,7 @@ check_deps_distro() {
168168
then SUPPORT_VER_LIST="${CENTOS_VER[@]}";
169169
else SUPPORT_VER_LIST="${FEDORA_VER[@]}";
170170
fi
171-
if (echo "${SUPPORT_VER_LIST}" | grep -v -w "${CMAJOR}" &>/dev/null);then
171+
if (echo "${SUPPORT_VER_LIST}" | grep -qvw "${CMAJOR}");then
172172
show_message error "Hyper support ${LSB_DISTRO}( ${SUPPORT_VER_LIST} ), but current is ${LSB_VER}"
173173
exit ${ERR_NOT_SUPPORT_DISTRO_VERSION[0]}
174174
fi

hyper-bootstrap.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ check_deps_distro() {
147147
if [ "${LSB_DISTRO}" == "linuxmint" ]
148148
then SUPPORT_CODE_LIST="${LINUX_MINT_CODE[@]}";
149149
fi
150-
if (echo "${SUPPORT_CODE_LIST}" | grep -v -w "${LSB_CODE}" &>/dev/null);then
150+
if (echo "${SUPPORT_CODE_LIST}" | grep -vqw "${LSB_CODE}");then
151151
show_message error "Hyper support ${LSB_DISTRO}( ${SUPPORT_CODE_LIST} ), but current is ${LSB_CODE}(${LSB_VER})"
152152
exit ${ERR_NOT_SUPPORT_DISTRO_VERSION[0]}
153153
fi
@@ -157,7 +157,7 @@ check_deps_distro() {
157157
then SUPPORT_CODE_LIST="${UBUNTU_CODE[@]}";
158158
else SUPPORT_CODE_LIST="${DEBIAN_CODE[@]}";
159159
fi
160-
if (echo "${SUPPORT_CODE_LIST}" | grep -v -w "${LSB_CODE}" &>/dev/null);then
160+
if (echo "${SUPPORT_CODE_LIST}" | grep -vqw "${LSB_CODE}");then
161161
show_message error "Hyper support ${LSB_DISTRO}( ${SUPPORT_CODE_LIST} ), but current is ${LSB_CODE}(${LSB_VER})"
162162
exit ${ERR_NOT_SUPPORT_DISTRO_VERSION[0]}
163163
fi
@@ -168,7 +168,7 @@ check_deps_distro() {
168168
then SUPPORT_VER_LIST="${CENTOS_VER[@]}";
169169
else SUPPORT_VER_LIST="${FEDORA_VER[@]}";
170170
fi
171-
if (echo "${SUPPORT_VER_LIST}" | grep -v -w "${CMAJOR}" &>/dev/null);then
171+
if (echo "${SUPPORT_VER_LIST}" | grep -qvw "${CMAJOR}");then
172172
show_message error "Hyper support ${LSB_DISTRO}( ${SUPPORT_VER_LIST} ), but current is ${LSB_VER}"
173173
exit ${ERR_NOT_SUPPORT_DISTRO_VERSION[0]}
174174
fi

0 commit comments

Comments
 (0)