base-files/functions.sh: remove useless cat
authorRosen Penev <rosenp@gmail.com>
Fri, 17 Jan 2020 04:43:56 +0000 (20:43 -0800)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Fri, 17 Jan 2020 11:17:36 +0000 (12:17 +0100)
The cut command can take a file as an input.

https://github.com/koalaman/shellcheck/wiki/SC2002

Signed-off-by: Rosen Penev <rosenp@gmail.com>
package/base-files/files/lib/functions.sh

index b118c8368cc441513a996e97b253a7f5bc753e71..40a7527aa52e7246dbeaa2f15ac40e6ed6fd1938 100755 (executable)
@@ -324,7 +324,7 @@ group_add_next() {
                echo $gid
                return
        fi
-       gids=$(cat ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
+       gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group)
        gid=65536
        while [ -n "$(echo "$gids" | grep "^$gid$")" ] ; do
                gid=$((gid + 1))
@@ -352,7 +352,7 @@ user_add() {
        local shell="${6:-/bin/false}"
        local rc
        [ -z "$uid" ] && {
-               uids=$(cat ${IPKG_INSTROOT}/etc/passwd | cut -d: -f3)
+               uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd)
                uid=65536
                while [ -n "$(echo "$uids" | grep "^$uid$")" ] ; do
                        uid=$((uid + 1))