]> git.ipfire.org Git - network.git/commitdiff
list: Avoid space in front of the first argument.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Aug 2012 09:32:29 +0000 (09:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Aug 2012 09:32:29 +0000 (09:32 +0000)
When the first argument was added to an empty list, there
was a leading space character which looks ugly.

functions.list

index d6d5305e61e2e1842cad42832604a661eadb12d1..bf5ab0e3c03bd97c8341065593e55314e6e753fb 100644 (file)
@@ -28,7 +28,11 @@ function list_append() {
 
        assert isset list
 
-       eval "${list}=\"${!list} $@\""
+       if [ -n "${!list}" ]; then
+               printf -v ${list} "${!list} $@"
+       else
+               printf -v ${list} "$@"
+       fi
 }
 
 function list_remove() {