Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We;ve already touched on difference kinds of Quoting in the shell. But there is an additional subtleties subtlety when handling script arguments.

Specifically: quoting a positional argument preserves argument quoting/grouping by the caller.

So there's a difference between these two ways of calling the helloWorld function inside our script:

Code Block
languagebash
# Wihout quotes, all argument grouping by the script caller is lost
helloWorld $@

# With quotes, argument quoting by the script caller is preserved
helloWorld "$@"

...