mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
Replace grep|awk|tail by just awk
This commit is contained in:
parent
00d9c4051d
commit
d2dd80d9f0
1 changed files with 1 additions and 1 deletions
2
shell/kd
2
shell/kd
|
|
@ -25,7 +25,7 @@ function kd() {
|
|||
fi
|
||||
if [[ $# -eq 1 ]]; then
|
||||
local target
|
||||
target="$(grep -e "^$1" "$conf" | awk '{ print $2 }' | tail -1)"
|
||||
target="$(awk "\$1 = /^${1}/ {a=\$2}; END { if (a) {print a}}" "$conf")"
|
||||
if [[ -n "$target" ]]; then
|
||||
if [[ -t 1 ]]; then
|
||||
cd "$target" || return 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue