From cfcdfb35c1a4bb0b6b963881d8bf8ea841f29906 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Sat, 18 Apr 2020 00:20:34 +0300 Subject: [PATCH] Simplify sudo groups check --- updatewine.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/updatewine.sh b/updatewine.sh index 9ffaa9e..23d10d3 100755 --- a/updatewine.sh +++ b/updatewine.sh @@ -124,14 +124,7 @@ if [[ $(uname -a | grep -c x86_64) -eq 0 ]]; then exit 1 fi -for i in ${SUDO_GROUPS[@]}; do - if [[ $(groups | grep -c ${i}) -ne 0 ]]; then - break - sudogrp=true - fi -done - -if [[ ! $sudogrp ]]; then +if [[ $(groups | grep -cE $(echo ${SUDO_GROUPS[*]} | sed 's/ /|/g')) -eq 0 ]]; then echo "You must belong to a sudo group (checked groups: ${SUDO_GROUPS[*]})." exit 1 fi