On Linux OS, run "realpath ~/bin" gives the correct path "/home/user1/bin".
But when I run it as bellow:
cmd := exec.Command("realpath", "~/bin")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
panic(err)
}
fmt.Println("Realapth:", out.String())
I got panic: exit status 1
.
BTW: with command as below:
cmd := exec.Command("realpath", "--help")
I can get correct help message for realpath
command. I think that means it is really in my executable path.