shellscript

package
v3.46.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package shellscript contains helpers for dealing with shell scripts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPOSIXShell

func IsPOSIXShell(line string) bool

IsPOSIXShell attempts to detect POSIX-compliant shells (e.g bash, sh, zsh) from either a plain command line, or a shebang line.

Examples:

  • IsPOSIXShell("/bin/sh") == true
  • IsPOSIXShell("/bin/fish") == false
  • IsPOSIXShell("#!/usr/bin/env bash") == true
  • IsPOSIXShell("#!/usr/bin/env python3") == false

func ShebangLine

func ShebangLine(path string) (string, error)

ShebangLine extracts the shebang line from the file, if present. If the file is readable but contains no shebang line, it will return an empty string. Non-nil errors only reflect an inability to read the file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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