On 5/20/18 12:30 PM, Hideki Yamane wrote: > On Sun, 20 May 2018 10:14:13 +0200 > Philipp Kern <pk...@debian.org> wrote: >> So the way it works with your patch is that local variables are >> inherited by called functions (but not the caller). So from and dest >> from just_get() are visible in wgetprogress() and hence the construction >> of $@ works. I'd rather have $dest and $from be explicit parameters to >> wgetprogress. Given that you reset $@ anyway I don't see how that'd hurt. > > Hmm, but if I don't put $dest and $from to $@ and other parameters are > empty, then it would be extracted as '' and wget will fail.
I'm saying: wgetprogress () { [...] local from="$1" local dest="$2" [...] set -- -O "$dest" "$from" [...] And then calling it with 'wgetprogress "$from" "$dest"' rather than implicitly reusing variables from the call stack. Kind regards Philipp Kern