- eval content=\"\${$list}\"
- IFS="$LISTSEP"
- if [ -z "$content" ]; then
- content="$*"
- else
- content="$content${LISTSEP}$*"
+ if [ $# -gt 0 ]; then
+ eval local_content=\"\${$local_list}\"
+ IFS="$LISTSEP"
+ local_newcontent="$*"
+ IFS="$SAVEIFS"
+ if [ -z "$local_content" ]; then
+ local_content="$local_newcontent"
+ else
+ local_content="$local_content${LISTSEP}$local_newcontent"
+ fi
+ eval $local_list=\"\${local_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 "$@"