Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bash-js-in

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bash-js-in - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

22

examples/example2.js
var { Run, Command } = require('../src/core');
(async function () {
var allExecutedCommands = await Run(seriesOfCommands());
console.log(`executed these commands: ${allExecutedCommands.map(c => c.command).join(' and ')}`);
var results = await Run(seriesOfCommands());
console.log();
console.log(`Summary:`);
console.log(`===`);
console.log(`executed ${results.length} commands`);
})();

@@ -12,3 +14,3 @@

var myIp = yield Command('curl --silent https://canihazip.com/s');
console.log(JSON.stringify(myIp, null, 2))
console.log(`\t\(^ ^)/ my IP is ${myIp.value}`);

@@ -18,13 +20,3 @@ // get a Quote of the Day

var quote = JSON.parse(quoteOfTheDay.value).contents.quotes[0];
console.log(`${quote.quote} -- ${quote.author}`);
console.log(`\t"${quote.quote}" -- ${quote.author}`);
}
// __OUTPUT__
// ==========
//
// {
// "command": "curl --silent https://canihazip.com/s",
// "value": "78.8.212.144\n"
// }
// He who is not courageous enough to take risks will accomplish nothing in life. -- Mohamad Ali
// executed these commands: curl --silent https://canihazip.com/s and curl --silent -X GET --header 'Accept: application/json' 'https://quotes.rest/qod'
{
"version": "1.0.5",
"version": "1.0.6",
"name": "bash-js-in",

@@ -4,0 +4,0 @@ "description": "Use Bash inside JavaScript",

@@ -15,2 +15,3 @@ # Bash JS in

- JavaScript backticks `` templating for Bash
- outputs command results to STDIN so it can be redirected

@@ -24,8 +25,7 @@ ## Requirements

``` javascript
var { Run, Command } = require('bash-js-in');
var { Run, Command } = require('../src/core');
(async function () {
var allExecutedCommands = await Run(seriesOfCommands());
console.log(`executed these commands: ${allExecutedCommands.map(c => c.command).join(' and ')}`);
var results = await Run(seriesOfCommands());
console.log(`executed ${results.length} commands`);
})();

@@ -36,3 +36,3 @@

var myIp = yield Command('curl --silent https://canihazip.com/s');
console.log(`my IP is ${myIp.value}`);
console.log(`\t\(^ ^)/ my IP is ${myIp.value}`);

@@ -42,3 +42,3 @@ // get a Quote of the Day

var quote = JSON.parse(quoteOfTheDay.value).contents.quotes[0];
console.log(`${quote.quote} -- ${quote.author}`);
console.log(`\t"${quote.quote}" -- ${quote.author}`);
}

@@ -49,5 +49,34 @@ ```

``` text
my IP is 72.8.212.142
He who is not courageous enough to take risks will accomplish nothing in life. -- Mohamad Ali
executed these commands: curl --silent https://canihazip.com/s and curl --silent -X GET --header 'Accept: application/json' 'https://quotes.rest/qod'
31.60.22.70
\(^ ^)/ my IP is 31.60.22.70
{
"success": {
"total": 1
},
"contents": {
"quotes": [
{
"quote": "He who is not courageous enough to take risks will accomplish nothing in life.",
"author": "Mohamad Ali",
"length": null,
"tags": [
"courage",
"inspire",
"risk"
],
"category": "inspire",
"title": "Inspiring Quote of the day",
"date": "2019-06-16",
"id": null
}
],
"copyright": "2017-19 theysaidso.com"
}
}
"He who is not courageous enough to take risks will accomplish nothing in life." -- Mohamad Ali
Summary:
===
executed 2 commands
```

@@ -54,0 +83,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc