Replace an array with positional parameters
POSIX sh has no arrays, but set -- a b c turns the positional parameters into one, and "$@" expands each element as its own word without splitting.
A POSIX shell script needs a list of items that may contain spaces, and there is no array type to hold it.
set -- "one two" three "four five"
printf '[%s]\n' "$@"
echo "count: $#"
set -- "$@" six
echo "after append: $#"[one two]
[three]
[four five]
count: 3
after append: 4set -- replaces the positional parameters, and "$@" expands to one word per parameter with the original boundaries kept. That makes it the only quoting-safe list in a shell without arrays. The rules are in the special parameters section of POSIX. Appending is the same idea: set the parameters to the old ones plus the new value.
The list is the script's own arguments, so it is overwritten for the whole script, and a function gets a separate copy only while it runs. If you need two lists at once, save one in a function call or in a file. Bash and ksh have real arrays and should use them.