From ae80789ad17ee1525fa30af5b15ca65adae610ae Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Sat, 19 Jul 2014 21:34:28 +0300 Subject: [PATCH] gcd reprogrammed --- qcd_function | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/qcd_function b/qcd_function index 7b76d8e..0b50f6d 100644 --- a/qcd_function +++ b/qcd_function @@ -168,33 +168,7 @@ function whenfilechanges() { } function gcd() { -# guess cd, find first match in folder - local dname - local bname - local match - local join - set -o pipefail - join="$@" - join=${join// /.} - dname=$( dirname "$join" ) - bname=$( basename "$join" ) - match=$( ls -d "$dname"/*/ | grep "$bname" | head -n 1 ) - [[ ! "$match" = "" ]] && { - echo $match | grep --color=always "$bname" - \cd "$match" - return - } - match=$( ls -d "$dname"/*/ | grep -i "$bname" | head -n 1 ) - [[ ! "$match" = "" ]] && { - echo $match | grep -i --color=always "$bname" - \cd "$match" - return - } - echo No match. -} - -function fcd() { - # gcd future fork +# guess cd, find first match in folder, or ask if multiple hits local cdto { cdto=$( python -c ' import sys,os,re @@ -266,7 +240,6 @@ except ValueError,IndexError: sys.exit(1) sys.stderr.write(os.path.join(pat_dir,key_match)) ' "$@" 2>&1 1>&$out); } {out}>&1 ; \cd "$cdto" - } function rmv () {