From edb11739954bc12066d7d31524aa9abafeeed26e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 26 Feb 2016 00:09:39 -0500 Subject: [PATCH] Add bin/back --- bin/back | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 bin/back diff --git a/bin/back b/bin/back new file mode 100755 index 00000000..5b4acd89 --- /dev/null +++ b/bin/back @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Jump to a parent directory +dir=$({ + _path=$PWD + while [[ -n "$_path" && "$_path" != "/" ]]; do + _path=$(dirname "$_path") + echo "$_path" + done +} | grep -i "$*" | tail -1) && cd "$dir"