Help us shape the future of Go! Take the 2026 Go Developer Survey

bash

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bash implements the `bash` built-in.

Usage:

bash [OPTIONS] [SCRIPT [ARG...]]

Options:

-c SCRIPT       run SCRIPT (passed inline)
-e              exit on error (set -e in the sub-shell)
-x              trace commands (set -x in the sub-shell)
-n              parse only — read and check syntax, do not run
-s              read script from stdin
--              end of options
--help          show this help and exit

Recursive invocations are tracked via the GOBASH_BASH_DEPTH env variable and bounded by Context.Limits.MaxSourceDepth. The child runs through Context.Exec, which routes back into the same *Bash runtime (sharing FS, registry, network, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() command.Command

New returns the bash command (Mode = ModeBash).

func Run

func Run(ctx context.Context, args []string, c *command.Context, mode Mode) command.Result

Run is the shared implementation used by both the `bash` and `sh` built-ins.

Types

type Mode

type Mode int

Mode selects which command name (`bash` or `sh`) we are implementing. The flag surface is identical; only the registered name and helper text differ.

const (
	ModeBash Mode = iota
	ModeSh
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL