Use https://github.com/google/zx instead. This repo is archived.
Tagged template to run shell script with execa
.
$ npm i shella
shella
returns a value that execa
returns.
const shella = require('shella');
(async () => {
// async by default
await shella`
echo abcde | sed -e 's/bcd/!!!/' > ./result.txt
grep a ./result.txt`;
// interporation (shell-escaped)
const msg = `Bob's pen`;
await shella`echo ${msg}`;
})();
// sync
shella.sync`echo foo`;
You can specify options for execa
.
shella
specify stdio: 'inherit'
by default, but the other options are execa
's default.
// with execa options
const {stdout, stderr} = await shella({stdio: 'pipe'})`echo foo`;
console.log(stdout);
// sync with execa options
shella.sync({stdio: 'pipe'})`echo foo`;
- execa: A better
child_process
- @tehshrike/shell-escape-tag: shell-escape-tag, but with a much smaller install size
MIT License: Teppei Sato <teppeis@gmail.com>