Skip to main content
Home

@spawn/bash@0.0.2
Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score100%
Publisheda year ago (0.0.2)

The bash module provides a simple way to execute bash scripts or files.

@spawn/bash

Overview

The bash module provides a simple way to execute bash scripts or files.

The module relies upon the @bearz/exec module and has the same basic usage as the Command and ShellCommand class.

Documentation

Documentation is available on jsr.io

Usage

import { bashScript, bash } from "@spawn/bash";

const cmd = await bashScript("echo 'Hello, World!'");
console.log(cmd.text());
console.log(cmd.code);

console.log(await bashScript("echo 'Hello, World!'").text());
console.log(await bashScript("test.sh").text()); 

// runs bash command and writes directly to console
await bashScript("echo 'I am alive'").run();

await bash(["-e", "path/to/file.sh"]).run();

License

MIT License

Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@spawn/bash

Import symbol

import * as bash from "@spawn/bash";
or

Import directly with a jsr specifier

import * as bash from "jsr:@spawn/bash";

Add Package

pnpm i jsr:@spawn/bash
or (using pnpm 10.8 or older)
pnpm dlx jsr add @spawn/bash

Import symbol

import * as bash from "@spawn/bash";

Add Package

yarn add jsr:@spawn/bash
or (using Yarn 4.8 or older)
yarn dlx jsr add @spawn/bash

Import symbol

import * as bash from "@spawn/bash";

Add Package

vlt install jsr:@spawn/bash

Import symbol

import * as bash from "@spawn/bash";

Add Package

npx jsr add @spawn/bash

Import symbol

import * as bash from "@spawn/bash";

Add Package

bunx jsr add @spawn/bash

Import symbol

import * as bash from "@spawn/bash";