diff options
-rw-r--r-- | home/john/.shrc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/home/john/.shrc b/home/john/.shrc index 4102b36..39e9dba 100644 --- a/home/john/.shrc +++ b/home/john/.shrc @@ -15,5 +15,14 @@ case "$-" in *i*) noice -p "$@" >$f && cd "$(cat $f)" rm $f } + go() { + [ -z "$1" ] && { echo usage: $0 [cmd ...] name 2>&1; return 1; } + eval name=\$$# + r=`find . -name "$name" -print -exit` + [ -z "$r" ] && { echo "$name" not found 2>&1; return 1; } + [ -f "$r" ] && name="$(dirname "$r")" + cd "$name" && + { [ $# -eq 1 ] && return; BASH_COMMAND=$* cmdtitle 2>&-; "$@"; } + } ;; esac |