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
|
allows you to simulate the --zero option of ls from
|
||||||
gnu coreutils v9, in earlier versions
|
gnu coreutils v9, in earlier versions
|
||||||
|
|
||||||
relies on coreutils (ls and tr), and grep with
|
also works with bsdgrep, for usage on bsd and mac
|
||||||
the -P option
|
|
||||||
|
relies on coreutils (ls and tr), and grep
|
||||||
|
|
||||||
simply source ls_zero.bash in your .bashrc,
|
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() {
|
_lsp() {
|
||||||
printf "%s" "$*" | grep -qP '(\s|^)--zero(\s|$)'
|
printf "%s" "$*" | grep -qE '(^| )--zero( |$)'
|
||||||
local zero=$?
|
local zero=$?
|
||||||
local args="$@"
|
local args="$@"
|
||||||
declare -a args=(${args[@]/--zero/})
|
declare -a args=(${args[@]/--zero/})
|
||||||
|
|||||||
Reference in New Issue
Block a user