Skip to content

Instantly share code, notes, and snippets.

@maxcnunes
Forked from yvele/get-npm-package-version.sh
Last active November 29, 2015 16:20
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 maxcnunes/bb121c68cef4cb8c96ab to your computer and use it in GitHub Desktop.
Save maxcnunes/bb121c68cef4cb8c96ab to your computer and use it in GitHub Desktop.
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[ ",]//g')
echo $PACKAGE_VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment