BTS

Message3780

Author ft
Recipients btittelbach
Date 2011-05-10.13:08:04
Content
Bernhard Tittelbach wrote:
> right. "$@" does not have word splitting problems even on (ba)sh
>
> $* on the other hand will separate by IFS, which is a problem if e.g. you have
> filenames with spaces.
>
> so yeah, if you meant "$@" then you are right, it just comes down to habituation
> in this case.

`$*' is something entirely different, yes. I've written a lengthy page
in zsh's wiki that explains some of the subtle differences between $*
and $@, double-quoted or not.

"$@" (the quoted form) however is rock solid. And also very
idiomatic. So idiomatic in fact that there's a short hand:

  % for i in "$@"; do ...; done

and

  % for i; do ...; done

are the same.

Also, while-shift is destructive with respect to $@. for-"$@" is not.

Regards, Frank
History
Date User Action Args
2011-05-10 13:08:04ftsetrecipients: + btittelbach
2011-05-10 13:08:04ftlinkissue982 messages
2011-05-10 13:08:04ftcreate