Automation, Orchestration, and Scripting

A script is started with ./deploy.sh prod. It defines log_msg() { echo "[$1]"; } and later runs log_msg "starting". What does the function print?

Show the answer

Correct answerC. [starting]

Inside a function, $1 refers to the function's own first argument, so it expands to starting. The script's argument prod is not visible as $1 there, which is the tempting wrong answer.