From 67b93d09ef2f60acd62d83bf3a9796e390b93bd7 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 15 Jun 2014 19:10:22 -0700 Subject: More aggressive variable scoping. --- rpath.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'rpath.sh') diff --git a/rpath.sh b/rpath.sh index 3f05790..f79abdc 100755 --- a/rpath.sh +++ b/rpath.sh @@ -52,7 +52,6 @@ _populate_dirs() { _populate_selected() { local dir dirs - unset selected IFS=':' read -a dirs <<< "${PATH}" @@ -93,6 +92,8 @@ _add() { } rpath_ls() { + local dir dirs selected str + _populate_dirs _populate_selected @@ -106,6 +107,8 @@ rpath_ls() { } rpath_get() { + local dir selected + _populate_selected || _die 'no rubies found in PATH.' for dir in "${selected[@]}"; do @@ -116,6 +119,8 @@ rpath_get() { rpath_set() { [[ -n "${1}" ]] || _die 'set command requires an argument.' + local dir dirs match + _populate_dirs for dir in "${dirs[@]}"; do -- cgit v1.2.3-70-g09d2