We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`liumou@liumou-PC:~/LinuxData/git/golang/dmeo$ cat demos.go package main
import ( "gitee.com/liumou_site/logger" "github.com/bitfield/script" )
func main() { // file := "/tts" pd := "1" c := "sudo -S rm -f /testing" res, err := script.Args().Echo(pd).ExecForEach(c).Stdout() logger.Debug("Exit code: ", res) if err != nil { logger.Error("Delete failed: ", err) } else { logger.Info("Deletion succeeded") } } liumou@liumou-PC:/LinuxData/git/golang/dmeo$ go run demos.go 请输入密码 sudo: no password was provided exit status 1 2022-12-09 00:10:59 [DEBG] [/home/liumou/LinuxData/git/golang/dmeo/demos.go:13] Exit code: 61 2022-12-09 00:10:59 [INFO] [/home/liumou/LinuxData/git/golang/dmeo/demos.go:17] Deletion succeeded liumou@liumou-PC:/LinuxData/git/golang/dmeo$ cat demo.sh #!/bin/bash file = "/tts" password = "demo" cmd = "rm -f ${file}" echo $password | sudo -S $cmd ` How do I handle the shell script function later
The text was updated successfully, but these errors were encountered:
This is working for me
Sorry, something went wrong.
No branches or pull requests
`liumou@liumou-PC:~/LinuxData/git/golang/dmeo$ cat demos.go
package main
import (
"gitee.com/liumou_site/logger"
"github.com/bitfield/script"
)
func main() {
// file := "/tts"
pd := "1"
c := "sudo -S rm -f /testing"
res, err := script.Args().Echo(pd).ExecForEach(c).Stdout()
logger.Debug("Exit code: ", res)
if err != nil {
logger.Error("Delete failed: ", err)
} else {
logger.Info("Deletion succeeded")
}
}
liumou@liumou-PC:
/LinuxData/git/golang/dmeo$ go run demos.go/LinuxData/git/golang/dmeo$ cat demo.sh请输入密码
sudo: no password was provided
exit status 1
2022-12-09 00:10:59 [DEBG] [/home/liumou/LinuxData/git/golang/dmeo/demos.go:13] Exit code: 61
2022-12-09 00:10:59 [INFO] [/home/liumou/LinuxData/git/golang/dmeo/demos.go:17] Deletion succeeded
liumou@liumou-PC:
#!/bin/bash
file = "/tts"
password = "demo"
cmd = "rm -f ${file}"
echo $password | sudo -S $cmd
`
How do I handle the shell script function later
The text was updated successfully, but these errors were encountered: