Use grep -q instead of redirection

This commit is contained in:
Julian Kornberger
2020-03-10 23:17:31 +01:00
parent 048ad22ea7
commit 27a6e93441
2 changed files with 4 additions and 4 deletions

View File

@@ -127,7 +127,7 @@ function check_prerequisites {
echo "SSH pubkey file is absent, please add it to the rescue system setting, then reboot into rescue system and run the script" echo "SSH pubkey file is absent, please add it to the rescue system setting, then reboot into rescue system and run the script"
exit 1 exit 1
fi fi
if ! dpkg-query --showformat="\${Status}" -W dialog 2> /dev/null | grep "install ok installed" &> /dev/null; then if ! dpkg-query --showformat="\${Status}" -W dialog 2> /dev/null | grep -q "install ok installed"; then
apt install --yes dialog apt install --yes dialog
fi fi
} }
@@ -389,7 +389,7 @@ function ask_hostname {
} }
function determine_kernel_variant { function determine_kernel_variant {
if dmidecode | grep vServer 2>&1; then if dmidecode | grep -q vServer; then
v_kernel_variant="-cloud" v_kernel_variant="-cloud"
fi fi
} }

View File

@@ -127,7 +127,7 @@ function check_prerequisites {
echo "SSH pubkey file is absent, please add it to the rescue system setting, then reboot into rescue system and run the script" echo "SSH pubkey file is absent, please add it to the rescue system setting, then reboot into rescue system and run the script"
exit 1 exit 1
fi fi
if ! dpkg-query --showformat="\${Status}" -W dialog 2> /dev/null | grep "install ok installed" &> /dev/null; then if ! dpkg-query --showformat="\${Status}" -W dialog 2> /dev/null | grep -q "install ok installed"; then
apt install --yes dialog apt install --yes dialog
fi fi
} }
@@ -354,7 +354,7 @@ function ask_hostname {
} }
function determine_kernel_variant { function determine_kernel_variant {
if dmidecode | grep vServer 2>&1; then if dmidecode | grep -q vServer; then
v_kernel_variant="-virtual" v_kernel_variant="-virtual"
fi fi
} }