From 27a6e93441c4db7b4a2fb58c6613036350eb6fc6 Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Tue, 10 Mar 2020 23:17:31 +0100 Subject: [PATCH] Use `grep -q` instead of redirection --- hetzner-debian10-zfs-setup.sh | 4 ++-- hetzner-ubuntu18-zfs-setup.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hetzner-debian10-zfs-setup.sh b/hetzner-debian10-zfs-setup.sh index ba86bc9..e47aa7b 100644 --- a/hetzner-debian10-zfs-setup.sh +++ b/hetzner-debian10-zfs-setup.sh @@ -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" exit 1 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 fi } @@ -389,7 +389,7 @@ function ask_hostname { } function determine_kernel_variant { - if dmidecode | grep vServer 2>&1; then + if dmidecode | grep -q vServer; then v_kernel_variant="-cloud" fi } diff --git a/hetzner-ubuntu18-zfs-setup.sh b/hetzner-ubuntu18-zfs-setup.sh index 9b772b0..932909b 100644 --- a/hetzner-ubuntu18-zfs-setup.sh +++ b/hetzner-ubuntu18-zfs-setup.sh @@ -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" exit 1 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 fi } @@ -354,7 +354,7 @@ function ask_hostname { } function determine_kernel_variant { - if dmidecode | grep vServer 2>&1; then + if dmidecode | grep -q vServer; then v_kernel_variant="-virtual" fi }