shell

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package shell contains high-level features that use the syntax and interp packages under the hood.

This package is a work in progress and EXPERIMENTAL; its API is not subject to the 1.x backwards compatibility guarantee.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(s string, env func(string) string) (string, error)

Expand performs shell expansion on s, using env to resolve variables. The expansion will apply to parameter expansions like $var and ${#var}, but also to arithmetic expansions like $((var + 3)), and command substitutions like $(echo foo).

If env is nil, the current environment variables are used.

Any side effects or modifications to the system are forbidden when interpreting the program. This is enforced via whitelists when executing programs and opening paths. The interpreter also has a timeout of two seconds.

func SourceFile

func SourceFile(path string) (map[string]interp.Variable, error)

SourceFile sources a shell file from disk and returns the variables declared in it.

A default parser is used; to set custom options, use SourceNode instead.

func SourceNode

func SourceNode(node syntax.Node) (map[string]interp.Variable, error)

SourceNode sources a shell program from a node and returns the variables declared in it.

Any side effects or modifications to the system are forbidden when interpreting the program. This is enforced via whitelists when executing programs and opening paths. The interpreter also has a timeout of two seconds.

Types

This section is empty.

Jump to

Keyboard shortcuts

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