summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-04-20 18:45:00 +0200
committerDave Reisner <dreisner@archlinux.org>2013-04-21 22:55:47 +0200
commit28dcc378781b22ee44363484583812515a4859e3 (patch)
treeef110bd93591ab8d730b2b26ce1f28d6a753f245
parent366bb180aa44bd8b4478e0dee94bf17be0dd82d8 (diff)
downloadmkinitcpio-28dcc378781b22ee44363484583812515a4859e3.tar.gz
mkinitcpio-28dcc378781b22ee44363484583812515a4859e3.tar.xz
functions: return a count of failures from map, if possible
I don't have any particular use case for this, but it might be nice to have this available in the future. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--functions2
1 files changed, 1 insertions, 1 deletions
diff --git a/functions b/functions
index 432d700..fac153c 100644
--- a/functions
+++ b/functions
@@ -193,7 +193,7 @@ die() {
map() {
local r=0
for _ in "${@:2}"; do
- "$1" "$_" || r=1
+ "$1" "$_" || (( $# > 255 ? r=1 : ++r ))
done
return $r
}