[issue982] update/modernize zsh functions simple-extractor, smartcompress & ogg2mp3

Frank Terbeck bts at bts.grml.org
Tue May 10 15:08:04 CEST 2011


Frank Terbeck <ft at grml.org> added the comment:

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

----------
assignedto: ft
files: ogg2mp3.zshrc.patch, simple-extractor.zshrc.patch
messages: 3745, 3746, 3747, 3768, 3769, 3770, 3774, 3776, 3777, 3778, 3779, 3780
nosy: btittelbach, ft
priority: feature
status: chatting
title: update/modernize zsh functions simple-extractor, smartcompress & ogg2mp3
topic: zsh

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue982>
_____________________________________


More information about the Bugs-changes mailing list