bash-vars

1.1.0 • Public • Published

bash-vars

turn a js object into something you can access from bash.

JSON is a subset of javascript, and bash-vars is a subset of bash.

//help-me-please-god.js
var BASH = require('bash-vars')
console.log(BASH.stringify({
  foo: 4,
  bar: {
    baz: 'hello'
  }
}))

will output

foo=4
bar__baz=hello

and then access that in bash like this...

# source the output of the node script...
# you have to output to a file, because BASH.
node help-me-please-god.js > config
. config
rm config
 
echo $foo
echo $bar__baz

api

stringify

convert js object into bash vars

parse

convert bash vars back into a js object.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i bash-vars

Weekly Downloads

4

Version

1.1.0

License

MIT

Last publish

Collaborators

  • nopersonsmodules