Skip to content

Instantly share code, notes, and snippets.

@cornerwings
Created August 6, 2010 09:53
Show Gist options
  • Save cornerwings/511118 to your computer and use it in GitHub Desktop.
Save cornerwings/511118 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Search upwards for $1 in directory tree.
pwd="`pwd`"
start="$pwd"
while [ ! "$pwd" -ef .. ]; do
[ -e "$1" ] && echo -n "$pwd" && exit
cd .. || exit 1
pwd="`pwd`"
done
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment