summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/uid-zero6
-rw-r--r--test/example.bats6
2 files changed, 6 insertions, 6 deletions
diff --git a/bin/uid-zero b/bin/uid-zero
index 9b2640f..64adac7 100755
--- a/bin/uid-zero
+++ b/bin/uid-zero
@@ -2,8 +2,4 @@
FILE=${1:-'/etc/passwd'}
-if [[ "$OSTYPE" == "darwin"* ]]; then
- cat $FILE | cut -d: -f1,3 | grep ':0'
-else
- cat $FILE | grep -P '^\w+:[x]:\d+:0.*$'
-fi
+cat "$FILE" | cut -d: -f1,3 | grep ':0'
diff --git a/test/example.bats b/test/example.bats
index 5acd1ad..98b6212 100644
--- a/test/example.bats
+++ b/test/example.bats
@@ -16,5 +16,9 @@ load test_helper
@test "produces an error" {
run rm blah
- assert_failure $'rm: blah: No such file or directory'
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ assert_failure $'rm: blah: No such file or directory'
+ else
+ assert_failure $'rm: cannot remove \'blah\': No such file or directory'
+ fi
}