about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--usercount.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/usercount.go b/usercount.go
index ff35463..a7084f1 100644
--- a/usercount.go
+++ b/usercount.go
@@ -9,12 +9,12 @@ import (
 // Just returns the number of directories in /home
 // The assumption being, it's the number of human users.
 func userCountQuery(format string) ([]byte, error) {
-	ls, err := exec.Command("ls", "/home").Output()
+	ls, err := exec.Command("/bin/ls", "/home").Output()
 	if err != nil {
 		return nil, fmt.Errorf("Couldn't execute ls: %w", err)
 	}
 
-	split := strings.Split(string(ls), " ")
+	split := strings.Fields(string(ls))
 
 	if format == "plain" {
 		return []byte(fmt.Sprintf("%v users", len(split))), nil