aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2020-07-25 20:19:44 +0200
committerOlav Vitters <olav@vitters.nl>2020-07-25 20:19:44 +0200
commit0a25ba446c1cb47a21b3f6056a10c90fea630c6f (patch)
tree0d5d0ca5ebb84227fa7ac44d23fc7500254261c0
parent99ec3fd689960ccc80cef6c54dc55cf887f2bcc5 (diff)
downloadrpm-helper-0a25ba446c1cb47a21b3f6056a10c90fea630c6f.tar
rpm-helper-0a25ba446c1cb47a21b3f6056a10c90fea630c6f.tar.gz
rpm-helper-0a25ba446c1cb47a21b3f6056a10c90fea630c6f.tar.bz2
rpm-helper-0a25ba446c1cb47a21b3f6056a10c90fea630c6f.tar.xz
rpm-helper-0a25ba446c1cb47a21b3f6056a10c90fea630c6f.zip
add-group: ShellCheck: fix various quoting issues
-rwxr-xr-xadd-group10
1 files changed, 5 insertions, 5 deletions
diff --git a/add-group b/add-group
index 4ecc350..3e8d967 100755
--- a/add-group
+++ b/add-group
@@ -20,8 +20,8 @@ num=$2 # number of packages installed
name=$3 # name of the group
users=$4 # users to add to this group
-if ! getent group $name > /dev/null 2>&1; then
- /usr/sbin/groupadd -r $name > /dev/null
+if ! getent group "$name" > /dev/null 2>&1; then
+ /usr/sbin/groupadd -r "$name" > /dev/null
if [ -n "$users" ]; then
SAVED_IFS="$IFS"
@@ -30,11 +30,11 @@ if ! getent group $name > /dev/null 2>&1; then
IFS="$SAVED_IFS"
for u in $*; do
- old=`egrep "[:,]$u(,|$)" /etc/group | cut -d : -f 1 | xargs echo`
+ old=$(grep -E "[:,]$u(,|$)" /etc/group | cut -d : -f 1 | xargs echo)
if [ -n "$old" ]; then
- old=`echo ",$old" | sed 's/ /,/g'`
+ old=$(echo ",$old" | sed 's/ /,/g')
fi
- /usr/sbin/usermod -G $name$old $u > /dev/null
+ /usr/sbin/usermod -G "$name$old" "$u" > /dev/null
done
fi
fi