Browse Source

Replace "awk" with "cut" for greater compatibility

Some really bizarre distributions don't include "awk" in the absolute minimum set, believe it or not! (I'm having a hard time believing it myself!)
Tianon Gravi 10 years ago
parent
commit
3fc27313e3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      test/tests/no-hard-coded-passwords/run.sh

+ 2 - 2
test/tests/no-hard-coded-passwords/run.sh

@@ -2,10 +2,10 @@
 set -e
 
 IFS=$'\n'
-userPasswds=( $(docker run --rm --user 0:0 --entrypoint awk "$1" -F ':' '{ print $1 ":" $2 }' /etc/passwd) )
+userPasswds=( $(docker run --rm --user 0:0 --entrypoint cut "$1" -d: -f1-2 /etc/passwd) )
 userShadows=()
 if echo "${userPasswds[*]}" | grep -qE ':x$'; then
-	userShadows=( $(docker run --rm --user 0:0 --entrypoint awk "$1" -F ':' '{ print $1 ":" $2 }' /etc/shadow || true) )
+	userShadows=( $(docker run --rm --user 0:0 --entrypoint cut "$1" -d: -f1-2 /etc/shadow || true) )
 fi
 unset IFS