I'm trying to execute a linux command and convert the output to an int. This is my current code:
package main
import (
"os/exec"
"os"
"strconv"
_"fmt"
"log"
"bytes"
)
func main(){
cmd := exec.Command("ulimit", "-n")
cmdOutput := &bytes.Buffer{}
cmd.Stdout = cmdOutput
err := cmd.Run()
if err != nil {
os.Stderr.WriteString(err.Error())
}
count, err := strconv.Atoi( string(cmdOutput.Bytes()) )
if err != nil {
log.Fatal(err)
}
if count <= 1024 {
log.Fatal("This machine is not good for working!!!")
}
}
This is my current error:
2018/10/12 14:37:27 exec: "ulimit -n": executable file not found in $PATH
I don't understand what this error means and how I can fix it.