Made more portable by using grep -E
This commit is contained in:
@ -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
|
||||
place it in /etc/profile.d, or similar
|
||||
|
||||
@ -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/})
|
||||
|
||||
Reference in New Issue
Block a user