package main import ( "os" "os/exec" ) func main() { f,_ := os.Create("1.txt") cmd := exec.Command("su","-","user00","-c","cd /tmp;nohup sh 1.sh &") cmd.Stdout = os.Stdout cmd.Stderr = f cmd.Run() }
package main import ( "os" "os/exec" ) func main() { f,_ := os.Create("1.txt") cmd := exec.Command("su","-","user00","-c","cd /tmp;nohup sh 1.sh &") cmd.Stdout = os.Stdout cmd.Stderr = f cmd.Run() }