blob: 995d9cd343b0cf9670eddc22af0d937cbe7cbb05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/bin/sh
#
# Locates directory that contains $1.
pwd="`pwd`"
start="$pwd"
while [ ! "$pwd" -ef .. ]; do
[ -e "$1" ] && echo -n "$pwd" && exit
cd .. || exit 1
pwd="`pwd`"
done
echo "Could not find '$1' in any sub-directory of '$start'" 1>&2
exit 1
|