What is the difference between `$*` and `"$@"`? Show it in a script.

BeginnerHands-onBash scripting tasks
Answer
show() { for a in "$@"; do echo "[$a]"; done; }
show "a b" c      # [a b] [c]
f() { show $*; }; f "a b" c   # [a] [b] [c]

"$@" expands to each argument as a separate quoted word. Unquoted $* (or $@) re-splits on spaces.

Key trick → Always forward arguments with "$@".

All Real-World Interview questions Roadmap: Interview readiness

More on Bash scripting tasks