I try to execute echo ${GOPATH} with call-process as below:
(call-process "echo" nil t nil "${GOPATH}")
But it only output "${GOPATH}" not the value of that value. Would anyone please let me know what the correct way to do it?
I try to execute echo ${GOPATH} with call-process as below:
(call-process "echo" nil t nil "${GOPATH}")
But it only output "${GOPATH}" not the value of that value. Would anyone please let me know what the correct way to do it?
You're looking for (call-process-shell-command "echo ${GOPATH}" nil t nil). In this case, ${PATH} is syntax defined by a shell, not a native call, so you'll need to invoke a shell to interpret it.
However, you may be interested in (insert (getenv "GOPATH")) which is considerably more direct, as it simply reads the environment instead of spawning a shell to read the environment in its stead.