Automation, Orchestration, and Scripting

A script is run as ./copy.sh "my file.txt" notes.txt. It loops over its arguments with for f in $@, but it treats my and file.txt as separate items. Which loop header processes each argument as exactly one item?

Show the answer

Correct answerD. for f in "$@"

Quoted "$@" expands to each positional parameter as a separate word, preserving embedded spaces. Quoted "$*" joins all arguments into one single word, and unquoted $* splits on spaces as the original loop did. $# is only the argument count.