Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    Much more robust to use the quoted "@"-form. To see the difference: a=("first element" "2nd elem"); printf "%s\n" ${a[@]}; printf "%s\n" "${a[@]}" Commented Dec 11, 2013 at 12:42
  • 1
    @glennjackman - thanks for the tip, I'll incorporate it. I always forget the @ vs. *. The * makes more sense given it's often assoc. w/ wildcards as "everything". Let me know if I've got it right now. Commented Dec 11, 2013 at 14:44
  • 3
    Yep that's it: unquoted, both @ and * expand to all the individual words in the array (split on $IFS); quoted, * expands to a single word (joined with $IFS); quoted, @ expands to each array element as a single word. Commented Dec 11, 2013 at 15:26