aboutsummaryrefslogtreecommitdiff
path: root/rbpm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rbpm.sh')
-rwxr-xr-xrbpm.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/rbpm.sh b/rbpm.sh
index 619fc03..cd0696d 100755
--- a/rbpm.sh
+++ b/rbpm.sh
@@ -44,10 +44,8 @@ _populate_dirs() {
[[ -d "${RUBIES_PATH}" ]] \
|| _die "directory ${RUBIES_PATH} does not exist."
- # Cannot handle paths containing a newline. Only an idiot would
- # encounter this in practice.
- readarray -t dirs < <(shopt -s nullglob; \
- printf '%s\0' "${RUBIES_PATH}"/* | sort -zV | xargs -0n1)
+ mapfile -td $'\0' dirs < <(shopt -s nullglob;
+ printf '%s\0' "${RUBIES_PATH}"/* | sort -zV)
[[ -n "${dirs}" ]] || _die "directory ${RUBIES_PATH} is empty."
}
@@ -55,7 +53,7 @@ _populate_dirs() {
_populate_selected() {
local dir dirs
- IFS=':' read -a dirs <<< "${PATH}"
+ mapfile -td ':' dirs < <(printf %s "${PATH}")
for dir in "${dirs[@]}"; do
if [[ "${dir}" == "${RUBIES_PATH}/"* ]]; then
@@ -72,7 +70,7 @@ _populate_selected() {
_clear() {
local dir dirs cdirs
- IFS=':' read -a dirs <<< "${PATH}"
+ mapfile -td ':' dirs < <(printf %s "${PATH}")
for dir in "${dirs[@]}"; do
if [[ "${dir}" == "${RUBIES_PATH}/"* ]]; then