Steve Long wrote:
> Thomas Sachau wrote: [...]
>
> > [[ -n ${DOCS} ]] && dodoc ${DOCS}
[...]
>
> It might be wise to use an array for DOCS there
Since I have now seen suggestions for using arrays unnecessarily
at least twice (see also
[RFC] Ability to pass arguments to src_configure/src_compile
but I am only speaking about the usage of _arrays_ here),
let me remark that the more clever way to this is
[ -n "${DOCS}" ] && eval "dodoc ${DOCS}"
This way, people can simply quote as they like:
DOCS="'filename with spaces' filename_without_space doc/*"
or also
DOCS="just_one_filename_without_special_characters"
or also - when Push from /usr/bin/functions-eix.sh is used
(which might be implemented simpler without using other functions):
Push DOCS 'filename with spaces' filename_without_space "${S}"/doc/*
Not only has this the advantage that it is POSIX (and thus does not
force ebuilds to use the particular shell "bash" - a policy which perhaps
some day might be changed: It is dangerous to depend on a particular
implementation), the array-less solution is also much simpler to
implement, easy to understand from the source, and clearer in usage.
Case distinctions like
> isArr() [[ $(declare -p "$1" 2>/dev/null) = 'declare -a'* ]]
> if isArr DOCS; then
> (([EMAIL PROTECTED])) && dodoc "[EMAIL PROTECTED]"
> else [[ $DOCS ]] && dodoc $DOCS
> fi
are just awful.