Skip to content

Instantly share code, notes, and snippets.

@pablote
Forked from DarrenN/get-npm-package-version
Last active April 27, 2020 20:41
Show Gist options
  • Save pablote/342881e2b2e61306f609dc26bf09357f to your computer and use it in GitHub Desktop.
Save pablote/342881e2b2e61306f609dc26bf09357f to your computer and use it in GitHub Desktop.
Extract version from package.json (NPM) using bash / shell
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed -e 's/^[[:space:]]*//')
echo $PACKAGE_VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment