## Problematic code:
#
# # Want to store multiple elements in var
# var=$@
# for i in $var; do ..; done
#
# or
#
# set -- Hello World
# # Want to concatenate multiple elements into a single string
# msg=$@
# echo "You said $msg"
#
## Correct code:
#
## # Bash: use an array variable
# var=( "$@" )
# for i in "${var[@]}"; do ..; done

# POSIX sh: without array support, one possible workaround
# is to store elements concatenated with a delimiter (here linefeed/newline)
var=$(printf '%s\n' "$@")
printf '%s\n' "$var" | while IFS='' read -r line; do ..; done

or

set -- Hello World
# Explicitly concatenates all the array elements into a single string
msg=$*
echo "You said $msg"
