aboutsummaryrefslogtreecommitdiff
path: root/rpath.sh
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-06-14 22:47:17 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-06-14 22:47:17 -0700
commit6bfa3b3efb8fbc3c447fd5ca93b9f0c1f10563ad (patch)
tree0a4d2315bbd74f761b80d5f560cc2501b6654c19 /rpath.sh
parentf8c18decf482f9ae06055ee6d19539848b484e31 (diff)
downloadrbpm-6bfa3b3efb8fbc3c447fd5ca93b9f0c1f10563ad.tar.gz
rbpm-6bfa3b3efb8fbc3c447fd5ca93b9f0c1f10563ad.tar.xz
Handle empty directory correctly.
Diffstat (limited to 'rpath.sh')
-rwxr-xr-xrpath.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/rpath.sh b/rpath.sh
index 468df59..1f24420 100755
--- a/rpath.sh
+++ b/rpath.sh
@@ -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