Sha256: 88e37bc39517546f91081567359bc9eb39d9010c0bca0e8865d277786e1019bd
Contents?: true
Size: 694 Bytes
Versions: 7
Compression:
Stored size: 694 Bytes
Contents
#!/usr/bin/env bash if [[ -z "$rvm_trace_flag" ]] ; then set +x ; else set -x ; fi if [[ ! -z "$ZSH_VERSION" ]] ; then __array_start=1 ; else __array_start=0 ; fi # Usage: contains "a_string" "${an_array[@]}" array_contains() { local pattern="$1" ; shift local index list list=("$@") for index in "${!list[@]}" ; do [[ ${list[index]} = $pattern ]] && { echo $index ; return 0 ; } done echo -1 ; return 1 } array_length() { array=$1 eval "length=\${#${array}[*]}" echo $length return $length } array_push() { array=$1 ; item=$2 # TODO: allow loop over more arguments. eval "index=\$((\${#${array}[*]} + $__array_start))" eval "${array}[${index}]=${item}" }
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
rvm-0.0.91 | scripts/array |
rvm-0.0.90 | scripts/array |
rvm-0.0.89 | scripts/array |
rvm-0.0.88 | scripts/array |
rvm-0.0.87 | scripts/array |
rvm-0.0.86 | scripts/array |
rvm-0.0.85 | scripts/array |