Skip to content

Instantly share code, notes, and snippets.

@joesteele
Last active August 29, 2015 13:57
Show Gist options
  • Save joesteele/9455884 to your computer and use it in GitHub Desktop.
Save joesteele/9455884 to your computer and use it in GitHub Desktop.
Grep Android Version Name or Code
function grepversion() {
if [[ -n "$1" ]]; then
local LOOKUP=Name
local APP=$1
if [[ -n "$1" && -n "$2" ]]; then
if [[ "$1" == "code" ]]; then
LOOKUP=Code
fi
APP=$2
fi
grep version$LOOKUP $APP/src/main/AndroidManifest.xml| sed -e 's/.*\s*=\s*\"\([0-9.]*\)\".*/\1/g'
else
echo "proper usage: grepversion <name|code> <module name>. (e.g. 'grepversion code MyApp' or just 'grepversion MyApp')"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment