diff options
author | Ulrich Müller <ulm@gentoo.org> | 2012-06-27 22:39:40 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2012-06-27 22:39:40 +0200 |
commit | 4975ec6a0a6ddc9ca63b7eb01c76302ad2d7c2a1 (patch) | |
tree | ea6cabd32c0a0ff70b031a2af798f30e985c5789 | |
parent | Update NEWS. (diff) | |
download | eselect-4975ec6a0a6ddc9ca63b7eb01c76302ad2d7c2a1.tar.gz eselect-4975ec6a0a6ddc9ca63b7eb01c76302ad2d7c2a1.tar.bz2 eselect-4975ec6a0a6ddc9ca63b7eb01c76302ad2d7c2a1.zip |
Declare local variables.
-rw-r--r-- | modules/binutils.eselect | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/binutils.eselect b/modules/binutils.eselect index 8694bd5..fe79723 100644 --- a/modules/binutils.eselect +++ b/modules/binutils.eselect @@ -12,7 +12,9 @@ BINUTILS_ENVFILE=${EROOT}/etc/env.d/05binutils # find_targets [patterns] # find all possible targets [that match one of ${@}] find_targets() { - local item targets + local item file + local -a targets + [[ $# -eq 0 ]] && set -- "-*" for item; do item=${item%%-[1-9]*} @@ -28,8 +30,9 @@ find_targets() { # find_versions # find all installed version of installed binutils find_versions() { + local target file last_versions_count local -a versions - local last_versions_count + for target in $(find_targets) ; do last_version_count=${#versions[@]} for file in "${EROOT}"/etc/env.d/binutils/${target}-* ; do @@ -45,6 +48,7 @@ find_versions() { # is_active $target $version # returns true if $version is currently used is_active() { + local current [[ ${#@} -eq 2 ]] || die "Need exactly 2 arguments!" current=$(load_config "${EROOT}/etc/env.d/binutils/config-${1}" CURRENT) [[ ${current} == ${2} ]] |