summaryrefslogtreecommitdiffstats
path: root/scripts/pathdown.sh
blob: 16c17b2a806776c880cb7fd67df6ecd2b179f176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
UP=
DN=${PWD:?}
TP=${TOPDIR:?}

while [ ! $TP/$UP/. -ef $DN ] ;do
	UP=`basename $PWD`/$UP
	cd ..
	if [ "$PWD" = "/" ]; then echo "Lost"; exit 1; fi
done

echo $UP
exit 0