From 64397c35fb21db7d47d0182eeaa44c2070fc6afa Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 14 Oct 2019 09:53:56 -0600 Subject: Add unit tests --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 28a1972..bbc7e94 100644 --- a/README.md +++ b/README.md @@ -1171,11 +1171,9 @@ Rootly Powers and Processes ```bash #!/bin/bash - if [[ "$OSTYPE" == "darwin"* ]]; then - cat /etc/passwd | cut -d: -f1,3 | grep ':0' - else - cat /etc/passwd | grep -P '^\w+:[x]:\d+:0.*$' - fi + FILE=${1:-'/etc/passwd'} + + cat "$FILE" | cut -d: -f1,3 | grep ':0' ``` b. Find entries that have no password (needs /etc/shadow). @@ -1183,7 +1181,9 @@ Rootly Powers and Processes ```bash #!/bin/bash - grep -E '^\w+::.*' /etc/passwd + FILE=${1:-'/etc/passwd'} + + grep -E '^\w+::.*' $FILE ``` c. Find any sets of entries that have duplicate UIDs. -- cgit v1.2.3