- eval content=\"\${$list}\"
- IFS="$LISTSEP"
- if [ -z "$content" ]; then
- content="$*"
- else
- content="$content${LISTSEP}$*"
+ if [ $# -gt 0 ]; then
+ eval content=\"\${$list}\"
+ IFS="$LISTSEP"
+ newcontent="$*"
+ IFS="$SAVEIFS"
+ if [ -z "$content" ]; then
+ content="$newcontent"
+ else
+ content="$content${LISTSEP}$newcontent"
+ fi
+ eval $list=\"\${content}\"
+ fi
+}
+
+# Like list_add, but only if first word to add ($2) is not empty
+list_add_not_empty () {
+ if [ -n "$2" ]; then
+ list_add "$@"