Skip to content
ntheanh201
WritingCertificationsCertsAbout

Fork: Extract version from package.json (NPM) using bash / shell

Aug 28, 2023 · 1 min read · linux

Link: https://gist.github.com/ntheanh201/3375b61dd6dfc3f55faad7061665a8da

PACKAGE_VERSION=$(cat package.json \
  | grep version \
  | head -1 \
  | awk -F: '{ print $2 }' \
  | sed 's/[",[:space:]]//g')

echo $PACKAGE_VERSION
← OlderNew domain name ^^Newer →UI package: Gather user feedback in your React apps
© 2026 The Anh NguyenGitHubLinkedInXFacebookRSSColophon