Extract package.json version using shell script Extract package.json version using shell script unix unix

Extract package.json version using shell script


If you have jq installed, it's really easy:

jq -r .version package.json


So i went ahead and used the readJson function from http://dailyraisin.com/read-json-value-in-bash/ which perfectly fits my need here


If you really want to use shell script then simply try it

sed 's/.*"version": "\(.*\)".*/\1/;t;d' ./package.json