diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-01 19:19:43 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-01 19:19:43 -0600 |
| commit | a89061ab6bdc2a6941aae2745b58f4f0482e1498 (patch) | |
| tree | 73d18c58757da32e5eceb73db77372e1b4001dcb /README.md | |
| parent | acadf7749ae6469f9d0fb946b4cb5cc5dcf17940 (diff) | |
Detect OS to use proper grep options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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). |
