Skip to content

Instantly share code, notes, and snippets.

@AndrewReitz
Created July 17, 2014 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewReitz/01a3e098b95ecb83fda0 to your computer and use it in GitHub Desktop.
Save AndrewReitz/01a3e098b95ecb83fda0 to your computer and use it in GitHub Desktop.
Linux Upfind + Gradlew
# Find something in a directory above the one you are in
function upfind() {
dir=`pwd`
while [ "$dir" != "/" ]; do
path=`find "$dir" -maxdepth 1 -name $1`
if [ ! -z $path ]; then
echo "$path"
return
fi
dir=`dirname "$dir"`
done
}
# Finds the gradle wrapper and executes it with the parameter passed in
function gw() {
$(upfind gradlew) $@
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment