Cool!

aide...@gentoo.org wrote:
> +_find_dep_version() {
> +     local pn="$1"
> +     local p
> +
> +     pushd "${EPREFIX}$(get_erl_libs)" >/dev/null
> +     for p in ${pn} ${pn}-*; do
> +             if [[ -d ${p} ]]; then
> +                     echo "${p#${pn}-}"
> +                     return 0

No popd on success?

> +             fi
> +     done
> +     popd >/dev/null
> +
> +     return 1
> +}



> +# @FUNCTION: eawk
> +# @USAGE: <file> <args>
> +# @DESCRIPTION:
> +# Edit file <file> in place with awk. Pass all arguments following <file> to
> +# awk.
> +eawk() {
> +     local f="$1"; shift
> +     local tmpf="$(emktemp)"
> +
> +     cat "${f}" >"${tmpf}" || return 1
> +     awk "$@" "${tmpf}" >"${f}"
> +}

Wouldn't it be nicer to cut cat, awk > $tmpf && mv $tmpf $f ?


//Peter

Reply via email to