Skip to content

Instantly share code, notes, and snippets.

@Oaphi
Last active August 31, 2021 00:46
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 Oaphi/2fd2c8712e71375f77cfdf42f60657be to your computer and use it in GitHub Desktop.
Save Oaphi/2fd2c8712e71375f77cfdf42f60657be to your computer and use it in GitHub Desktop.
Various bash helpers
# extracts NPM environment variable names
npm_val() {
local value=$(ENV | grep -e "npm_package_$1" | cut -d "=" -f 2)
echo $value
}
# splits a string on dashes and rejoins with first letter uppercased
pretty() {
IFS=\-
local output
for c in $1; do
output="$output ${c^}"
done
echo $output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment