diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-06-14 22:47:17 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-06-14 22:47:17 -0700 |
commit | 6bfa3b3efb8fbc3c447fd5ca93b9f0c1f10563ad (patch) | |
tree | 0a4d2315bbd74f761b80d5f560cc2501b6654c19 | |
parent | f8c18decf482f9ae06055ee6d19539848b484e31 (diff) | |
download | rbpm-6bfa3b3efb8fbc3c447fd5ca93b9f0c1f10563ad.tar.gz rbpm-6bfa3b3efb8fbc3c447fd5ca93b9f0c1f10563ad.tar.xz |
Handle empty directory correctly.
-rwxr-xr-x | rpath.sh | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -42,8 +42,10 @@ _populate_dirs() { # Cannot handle paths containing a newline. Only an idiot would # encounter this in practice. - readarray -t dirs < \ - <(printf '%s\0' "${RUBIES_PATH}"/* | sort -zV | xargs -0n1) + readarray -t dirs < <(shopt -s nullglob; \ + printf '%s\0' "${RUBIES_PATH}"/* | sort -zV | xargs -0n1) + + [[ -n "${dirs}" ]] || _die "Directory ${RUBIES_PATH} is empty." } _match() { @@ -120,7 +122,7 @@ rpath_get() { } rpath_set() { - [[ -z "${1}" ]] && _die 'rpath set requires an argument.' + [[ -n "${1}" ]] || _die 'rpath set requires an argument.' _populate_dirs |