From: Michael Tremer Date: Mon, 10 Sep 2012 08:33:13 +0000 (+0000) Subject: list: Add function to join a list. X-Git-Tag: 005~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=805243f645e954fa595519dc571c11b8fe0c95df;p=network.git list: Add function to join a list. --- diff --git a/functions.list b/functions.list index 2308b1e9..fa22a666 100644 --- a/functions.list +++ b/functions.list @@ -98,3 +98,13 @@ function list_count() { print "${counter}" } + +function list_join() { + local list=${1} + local delim=${2} + + local ret + printf -v ret "${delim}%s" ${!list} + + print "${ret:${#delim}}" +}