diff --git a/extra/completion.bash b/extra/completion.bash index be4783e..c2496b8 100755 --- a/extra/completion.bash +++ b/extra/completion.bash @@ -6,8 +6,8 @@ _path_gen() { [ -z "${glob_status##*u*}" ] && shopt -s globstar # if recursive globbing is disabled, enable it local full_paths=("$sshyp_path"/**/*.gpg) $glob_status # set recursive globbing to user default - for path in "${full_paths[@]}"; do - trimmed_paths+=("${path:${#sshyp_path}:-4}") + for scan_path in "${full_paths[@]}"; do + trimmed_paths+=("${scan_path:${#sshyp_path}:-4}") done if [ "${trimmed_paths[0]}" == '/**/*' ]; then trimmed_paths[0]=help; fi } && diff --git a/extra/completion.zsh b/extra/completion.zsh index 15382e8..1fb97c4 100755 --- a/extra/completion.zsh +++ b/extra/completion.zsh @@ -2,10 +2,11 @@ sshyp_path="$HOME/.local/share/sshyp" full_paths=("$sshyp_path"/**/*.gpg) +trimmed_paths=() for scan_path in "${full_paths[@]}"; do trimmed_paths+=("${${scan_path#$sshyp_path}%????}") done -[[ -v trimmed_paths ]] || trimmed_paths=(help) +[[ -z $trimmed_paths ]] && trimmed_paths=(help) case ${words[-2]} in sshyp )