Basic Usage
Execute a shell script:Cross-Platform Shell
Bun’s shell works on Windows, macOS, and Linux:Features
- Cross-platform compatibility
- Pipes and redirects
- Environment variable expansion
- Command substitution
Examples
Pipes
Redirects
Environment Variables
Command Substitution
vs Shell Scripts
Usebun exec for:
- Cross-platform scripts
- Simple automation
- CI/CD pipelines
- Complex bash features
- System administration
- Platform-specific tasks
$ Shell in TypeScript
For programmatic shell usage in TypeScript, use Bun’s$ API:
Next Steps
Shell API
Use $ shell in TypeScript
bun run
Run JavaScript files