From 085923abb97b5013f8121f3b2247c318631a6f50 Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Sat, 14 Jan 2023 21:21:15 +0100 Subject: [PATCH] added new "go" subroutine for reaching folder fast --- .bashrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.bashrc b/.bashrc index b529c2d..10e7dbb 100644 --- a/.bashrc +++ b/.bashrc @@ -290,6 +290,22 @@ bash_plugin() { fi } +go() { + DIRS=($(cat -n ~/bin/go_dirs)) + + select=$(dialog --menu "Go to..." 20 100 16 "${DIRS[@]}" 3>&1 1>&2 2>&3) + + dialog --clear + if [ $? -ne 0 ] + then + exit 1 + fi + + p="${DIRS[$select * 2 - 1]}" + p="${p/#\~/$HOME}" + cd $p +} + trap bash_plugin DEBUG