From 9ab175a8d83e8eb1bd0ac385765b1b32a5cfca35 Mon Sep 17 00:00:00 2001 From: Cuan Date: Thu, 8 Sep 2022 09:47:59 -0400 Subject: [PATCH] Roughly halved the amount of time to source bash completions Former-commit-id: 624a99a5727e49b12c1468c27110cee893124fd2 [formerly f411a56d1fcfffa6229077a7176af61dbeebb0a8] Former-commit-id: 48802e27abb02efaf80743bd4fc8dbe3a03219fa --- extra/sshyp-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/sshyp-completion.bash b/extra/sshyp-completion.bash index 4f93cd4..10581f2 100755 --- a/extra/sshyp-completion.bash +++ b/extra/sshyp-completion.bash @@ -5,7 +5,8 @@ _path_gen() { local sshyp_path_length="$(("${#sshyp_path}" + 1))" readarray -t full_paths < <(find "$sshyp_path" -type f -exec ls {} \;) for path in "${full_paths[@]}"; do - trimmed_path=$(echo $path | sed 's/.\{4\}$//' | cut -c"$sshyp_path_length"-) + trimmed_path=${path%????} + trimmed_path=$(echo $trimmed_path | cut -c"$sshyp_path_length"-) trimmed_path=$(echo ${trimmed_path// /\\ }) trimmed_paths+=("$trimmed_path") done