LinuxCommandLibrary

bun-c

Run a shell command string through Bun's built-in shell

TLDR

Run a shell command
$ bun -c "[shell command]"
copy
Run a pipeline
$ bun -c "cat [file.txt] | grep [pattern]"
copy
Run with environment from .env file
$ bun -c "[command]" --env-file [.env]
copy

SYNOPSIS

bun -c command [options]

DESCRIPTION

bun -c runs a shell command string, similar to sh -c but using Bun's built-in cross-platform shell implementation. It supports common shell features like pipes, redirects, and environment variable expansion. It can load environment variables from .env files before executing the command, making it useful for running scripts that depend on environment configuration without additional tooling.

PARAMETERS

-c command

Execute the given command string using Bun's built-in shell.
--env-file file
Load environment variables from the specified file before executing.

SEE ALSO

bun(1), bun-run(1), bun-x(1), sh(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard