Skip to content

Instantly share code, notes, and snippets.

@bhavanki
Created August 9, 2013 19:12
Show Gist options
  • Save bhavanki/6196312 to your computer and use it in GitHub Desktop.
Save bhavanki/6196312 to your computer and use it in GitHub Desktop.
Simple script to bounce you back up to the first parent directory with a Maven POM in it. Must be sourced to work as expected (so alias it).
#!/bin/bash
POMDIR=$(pwd)
while [[ "$POMDIR" != "/" && ! -f "$POMDIR/pom.xml" ]]; do
POMDIR=$(dirname "$POMDIR")
done
if [[ "$POMDIR" != "/" ]]; then
cd "$POMDIR"
else
echo Not in project
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment