bun-shell
SolidBun shell scripting with Bun.$, Bun.spawn, subprocess management. Use for shell commands, template literals, or command execution.
Data & Documents 162 stars
25 forks Updated 2 weeks ago MIT
Install
Quality Score: 88/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Bun Shell
Bun provides powerful shell scripting capabilities with template literals and spawn APIs.
## Bun.$ (Shell Template)
### Basic Usage
```typescript
import { $ } from "bun";
// Run command
await $`echo "Hello World"`;
// Get output
const result = await $`ls -la`.text();
console.log(result);
// JSON output
const pkg = await $`cat package.json`.json();
console.log(pkg.name);
```
### Variable Interpolation
```typescript
import { $ } from "bun";
const name = "world";
const dir = "./src";
// Safe interpolation (escaped)
await $`echo "Hello ${name}"`;
await $`ls ${dir}`;
// Array expansion
const files = ["a.txt", "b.txt", "c.txt"];
await $`touch ${files}`;
```
### Piping
```typescript
import { $ } from "bun";
// Pipe commands
const result = await $`cat file.txt | grep "pattern" | wc -l`.text();
// Chain with JavaScript
const files = await $`ls -la`.text();
const lines = files.split("\n").filter(line => line.includes(".ts"));
```
### Error Handling
```typescript
import { $ } from "bun";
// Throws on non-zero exit
try {
await $`exit 1`;
} catch (err) {
console.log(err.exitCode); // 1
console.log(err.stderr);
}
// Quiet mode (no throw)
const result = await $`exit 1`.quiet();
console.log(result.exitCode); // 1
// Check exit code
const { exitCode } = await $`grep pattern file.txt`.quiet();
if (exitCode !== 0) {
console.log("Pattern not found");
}
```
### Output Types
```typescript
import { $ } from "bun";
// Text
const text = await $`echo hello`....
Details
- Author
- secondsky
- Repository
- secondsky/claude-skills
- Created
- 6 months ago
- Last Updated
- 2 weeks ago
- Language
- TypeScript
- License
- MIT
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Listed
bun
Build fast applications with Bun JavaScript runtime. Use when creating Bun projects, using Bun APIs, bundling, testing, or optimizing Node.js alternatives. Triggers on Bun, Bun runtime, bun.sh, bunx, Bun serve, Bun test, JavaScript runtime.
2 Updated today
Makiya1202 Data & Documents Solid
bun-shell-commands
Writing shell commands for OpenCode custom commands using Bun Shell
364 Updated today
majiayu000 Data & Documents Solid
bun-runtime
Use for Bun runtime, bunfig.toml, watch/hot modes, env vars, CLI flags, and module resolution.
162 Updated 2 weeks ago
secondsky AI & Automation Solid
bun-runtime
Bun 作为运行时、包管理器、打包器和测试运行器。何时选择 Bun 而非 Node、迁移注意事项以及 Vercel 支持。
148,923 Updated 1 months ago
affaan-m DevOps & Infrastructure Listed
bun-runtime
Bun runtime management, scripting, package management, and server deployment.
0 Updated 2 months ago
UltraXn