summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2019-10-01 19:19:43 -0600
committermo khan <mo.khan@gmail.com>2019-10-01 19:19:43 -0600
commita89061ab6bdc2a6941aae2745b58f4f0482e1498 (patch)
tree73d18c58757da32e5eceb73db77372e1b4001dcb /README.md
parentacadf7749ae6469f9d0fb946b4cb5cc5dcf17940 (diff)
Detect OS to use proper grep options
Diffstat (limited to 'README.md')
-rw-r--r--README.md8
1 files changed, 6 insertions, 2 deletions
diff --git a/README.md b/README.md
index 13c1fe5..d6fbbf0 100644
--- a/README.md
+++ b/README.md
@@ -1129,9 +1129,13 @@ Rootly Powers and Processes
a. Find entries that have UID 0.
```bash
- #!/bin/sh
+ #!/bin/bash
- cat /etc/passwd | grep -P '^\w+:[x]:\d+:0.*$'
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ cat /etc/passwd | cut -d: -f1,3 | grep ':0'
+ else
+ cat /etc/passwd | grep -P '^\w+:[x]:\d+:0.*$'
+ fi
```
b. Find entries that have that have no password (needs /etc/shadow).