From 06f5ca98018fd4ba357b0e70b1e710b682b6cdb5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 14 Dec 2015 17:48:52 +1300 Subject: Switch to a faster method of array appending Does away with the nasty hack around man page discovery, and still compatible with Bash 2.05a --- bash/bashrc.d/vis.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bash/bashrc.d/vis.bash') diff --git a/bash/bashrc.d/vis.bash b/bash/bashrc.d/vis.bash index 02981afe..93b4098c 100644 --- a/bash/bashrc.d/vis.bash +++ b/bash/bashrc.d/vis.bash @@ -5,7 +5,7 @@ _vis() { vispath=${VISPATH:-$HOME/.local/bin} [[ -d $vispath ]] || return while IFS= read -d '' -r executable ; do - COMPREPLY=("${COMPREPLY[@]}" "$executable") + COMPREPLY[${#COMPREPLY[@]}]=$executable done < <( shopt -s dotglob nullglob declare -a files @@ -13,7 +13,7 @@ _vis() { declare -a executables for file in "${files[@]}" ; do [[ -f $file && -x $file ]] || continue - executables=("${executables[@]}" "${file##*/}") + executables[${#executables[@]}]=${file##*/} done ((${#executables[@]})) || exit 1 printf '%q\0' "${executables[@]}" -- cgit v1.2.3