When the list is called "list" we have a problem because
${list}="list"
and ${!list}="list"
This creates effects nobody wants and which are also not so easy to understand.
To avoid such problems in the future we now throw an assertation when the list is called list.
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
list_append() {
local list=${1}
assert isset list
+ assert [ ${list} != "list" ]
shift
local arg
shift
assert isset list
+ assert [ ${list} != "list" ]
if [ -n "${!list}" ]; then
printf -v ${list} -- "${!list} $@"
shift
assert isset list
+ assert [ ${list} != "list" ]
local _list k
for k in ${!list}; do
local list=${1}
local delim=${2}
+ assert isset list
+ assert isset delim
+ assert [ ${list} != "list" ]
+
local ret
printf -v ret "${delim}%s" ${!list}