package fileutil
Import Path
mvdan.cc/sh/v3/fileutil (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
Package fileutil allows inspecting shell files, such as detecting whether a
file may be shell or extracting its shebang.
Package-Level Type Names (only one)
ScriptConfidence defines how likely a file is to be a shell script,
from complete certainty that it is not one to complete certainty that
it is one.
func CouldBeScript(info os.FileInfo) ScriptConfidence
func CouldBeScript2(entry fs.DirEntry) ScriptConfidence
const ConfIfShebang
const ConfIsScript
const ConfNotScript
Package-Level Functions (total 4)
CouldBeScript is a shortcut for CouldBeScript2(fs.FileInfoToDirEntry(info)).
Deprecated: prefer CouldBeScript2, which usually requires fewer syscalls.
CouldBeScript2 reports how likely a directory entry is to be a shell script.
It discards directories, symlinks, hidden files and files with non-shell
extensions.
HasShebang reports whether bs begins with a valid shell shebang.
It supports variations with /usr and env.
Shebang parses a "#!" sequence from the beginning of the input bytes,
and returns the shell that it points to.
For instance, it returns "sh" for "#!/bin/sh",
and "bash" for "#!/usr/bin/env bash".
Package-Level Constants (total 3)
ConfIfShebang describes files which might be shell scripts, depending
on the shebang line in the file's contents. Since CouldBeScript only
works on os.FileInfo, the answer in this case can't be final.
ConfIsScript describes files which are definitely shell scripts,
which are regular files with a valid shell extension.
ConfNotScript describes files which are definitely not shell scripts,
such as non-regular files or files with a non-shell extension.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |