From e59324a53fda9c02d82f4062409e9a6d4db0c48a Mon Sep 17 00:00:00 2001 From: Seoxi Ryouko Date: Sun, 4 May 2025 22:58:17 -0400 Subject: [PATCH] Made more portable by using grep -E --- README.md | 7 ++++--- ls_zero.bash | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 11f9b76..29225e2 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ ls zero bash polyfill allows you to simulate the --zero option of ls from gnu coreutils v9, in earlier versions -relies on coreutils (ls and tr), and grep with -the -P option +also works with bsdgrep, for usage on bsd and mac + +relies on coreutils (ls and tr), and grep simply source ls_zero.bash in your .bashrc, -place it in /etc/profile.d, or similar \ No newline at end of file +place it in /etc/profile.d, or similar diff --git a/ls_zero.bash b/ls_zero.bash index 8a081bd..5c1e77a 100644 --- a/ls_zero.bash +++ b/ls_zero.bash @@ -4,7 +4,7 @@ _ls() { } _lsp() { - printf "%s" "$*" | grep -qP '(\s|^)--zero(\s|$)' + printf "%s" "$*" | grep -qE '(^| )--zero( |$)' local zero=$? local args="$@" declare -a args=(${args[@]/--zero/})