murdock: make _greplist() not return error code on empty list

This commit is contained in:
Kaspar Schleiser 2019-07-02 10:24:28 +02:00
parent 5c676dea23
commit 6e08151efe

View File

@ -62,11 +62,17 @@ is_in_list() {
echo "$haystack" | grep -q -w "$needle" echo "$haystack" | grep -q -w "$needle"
} }
# grep that doesn't return error on empty input
_grep() {
grep "$@"
true
}
_greplist() { _greplist() {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo cat echo cat
else else
echo -n "grep -E ($1" echo -n "_grep -E ($1"
shift shift
for i in $*; do for i in $*; do
echo -n "|$i" echo -n "|$i"