>>>>> On Wed, 21 Aug 2013, Michał Górny wrote: > Proposed implementation follows:
> einstalldocs() { > if ! declare -p DOCS &>/dev/null ; then > local d > for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ > THANKS BUGS FAQ CREDITS CHANGELOG ; do > [[ -s "${d}" ]] && dodoc "${d}" The first pair of quotes is not needed. > done > elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then > [[ ${DOCS[@]} ]] && dodoc -r "${DOCS[@]}" I'd test for [[ ${#DOCS[@]} -gt 0 ]] here, but presumably that's a matter of taste. > else > [[ ${DOCS} ]] && dodoc -r ${DOCS} > fi > > if [[ $(declare -p HTML_DOCS) == "declare -a "* ]] ; then This will emit an error message if HTML_DOCS is unset. So: if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a "* ]] ; then > dohtml -r "${HTML_DOCS[@]}" No test for empty array here? > elif [[ ${HTML_DOCS} ]]; then > dohtml -r ${HTML_DOCS} Make this the same as the DOCS logic, i.e.: else [[ ${HTML_DOCS} ]] && dohtml -r ${HTML_DOCS} > fi Maybe add a "return 0" here? > } Ulrich