17:facad31ec0dc
Anton Shestakov <engored@ya.ru>, Sat, 29 Nov 2014 12:56:58 +0800
find-closest: searching for a thing in parent dirs, a la jQuery.closest

find-closest/hgroot_2.sh

Permissions: -rwxr-xr-x

Other formats: Feeds:
#!/bin/bash
root="$PWD"
while true ; do
[[ -d "$root/.hg" ]] && echo "$root" && break
[[ $root == '/' ]] && break
root="$(dirname "$root")"
done