From 64e786dbde2b2380416b88ae1102bebece618b9b Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Tue, 6 Jul 2021 14:30:12 +0200 Subject: [PATCH] Fix kd with spaces --- shell/kd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/kd b/shell/kd index dfc398d..3358470 100755 --- a/shell/kd +++ b/shell/kd @@ -1,6 +1,10 @@ # vim: ft=bash # shellcheck shell=bash +# TODO: make relative paths absolute (use . possible) +# TODO: create kdrc if not exist +# TODO: use .config/kd + # worKDir or quicKDir function kd() { local conf="$HOME/.kdrc" @@ -25,7 +29,7 @@ function kd() { fi if [[ $# -eq 1 ]]; then local target - target="$(awk "\$1 = /^${1}/ {a=\$2}; END { if (a) {print a}}" "$conf")" + target="$(awk "match(\$0, /^${1}/) {match(\$0, / .*/); a=substr(\$0,RSTART+1,RLENGTH-1)}; END { if (a) {print a}}" "$conf")" if [[ -n "$target" ]]; then if [[ -t 1 ]]; then cd "$target" || return 1