On Tuesday 02 February 2010 18:51:28 Frank Terbeck wrote: > > setopt extendedglob > > I think adding `nullbglob' here would make sense, too, so the glob below > doesn't error out if it doesn't match anything. Your right. I forgot to specify nullglob in this situation. It didn't test the example probable. just ran some individual parts within my zsh session which sets nullglob by default. > > matches=("$HOME"/((.*|*)/)#*(#q^u${SUDO_UID}u${UID},^g${SUDO_GID}g${GID}) > >) [[ -n ${matches} ]] && chown $SUDO_UID:$SUDO_GID "${matches[@]}" > > (( ${#matches} > 0 )) && ... > [[ -n ${matches} ]] only needs to check if the array "matches" is not empty (( ${#matches} > 0 )) needs to calculate the length of the array and compare if the result is > 0. I think [[ -n ${matches} ]] will be more efficient.
Attachment:
signature.asc
Description: This is a digitally signed message part.