Documentation ¶
Index ¶
- func CheckCmd(cmd string) bool
- func GetUserInfo(display bool) (ok bool, username string, userid int, UserHome string)
- func Version()
- type ShellDebug
- func (shells *ShellDebug) GetStatusOutputBool(cmd string) (bool, string, error)
- func (shells *ShellDebug) ScriptGetStatusOutput(cmds string) (excode int, out string, err error)
- func (shells *ShellDebug) Shell(command string) bool
- func (shells *ShellDebug) ShellGetOutSudo(cmd string) (bool, string)
- func (shells *ShellDebug) ShellSudo(command string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserInfo ¶
Types ¶
type ShellDebug ¶
type ShellDebug struct {
// contains filtered or unexported fields
}
定义命令的结构体
func ShellInit ¶
func ShellInit(debug, prints, ptinter bool, password string) *ShellDebug
命令实例构造函数, 当不需要执行sudo命令的时候直接传入任意字符串给password即可
func (*ShellDebug) GetStatusOutputBool ¶
func (shells *ShellDebug) GetStatusOutputBool(cmd string) (bool, string, error)
执行命令并获取输出数据, 返回执行结果布尔值 - (成功/失败)及 命令输出 (字符串)
func (*ShellDebug) ScriptGetStatusOutput ¶
func (shells *ShellDebug) ScriptGetStatusOutput(cmds string) (excode int, out string, err error)
使用第三方脚本二次开发
func (*ShellDebug) Shell ¶
func (shells *ShellDebug) Shell(command string) bool
执行命令并获取执行结果, 返回执行结果(成功/失败)
func (*ShellDebug) ShellGetOutSudo ¶
func (shells *ShellDebug) ShellGetOutSudo(cmd string) (bool, string)
通过Sudo权限执行命令并获取输出数据, 返回执行结果(成功/失败)及命令输出(字符串)
func (*ShellDebug) ShellSudo ¶
func (shells *ShellDebug) ShellSudo(command string) bool
执行命令并获取执行结果, 返回执行结果(成功/失败)
Click to show internal directories.
Click to hide internal directories.