1 Star 0 Fork 0

litian / machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
shell.go 471 Bytes
一键复制 编辑 原始数据 按行查看 历史
// +build !windows
package shell
import (
"errors"
"fmt"
"os"
"path/filepath"
)
var (
ErrUnknownShell = errors.New("Error: Unknown shell")
)
// Detect detects user's current shell.
func Detect() (string, error) {
shell := os.Getenv("SHELL")
if shell == "" {
fmt.Printf("The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.\n\n")
return "", ErrUnknownShell
}
return filepath.Base(shell), nil
}
1
https://gitee.com/litian33/machine.git
git@gitee.com:litian33/machine.git
litian33
machine
machine
v0.13.0

搜索帮助