- which
- where
- exec
- LookPath
Find executable (which where)
- Unix: which
- Windows: where
- Go:
examples/find-executable/find_executable.go
package main import ( "fmt" "os" "os/exec" ) func main() { path, err := exec.LookPath("python") if err != nil { fmt.Println("Could not find path") os.Exit(1) } fmt.Printf("%v %T\n", path, path) }
/home/gabor/venv3/bin/python string