Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Different getenv("PATH") and $PATH on macos M1 (for libclang.dylib)
Re: Different getenv("PATH") and $PATH on macos [message #59492 is a reply to message #59490] Thu, 05 January 2023 23:37 Go to previous messageGo to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Oblivion wrote on Thu, 05 January 2023 15:37
Hi,

...
Since $PATH is not part of unix echo command, it is a *shell* variable, it is actually the responsibility of shell to replace it with the actual path here. You need to run the command via a shell so that it can inherit the shell's env, and the shell can replace the variable with the output.

And using bash does not seem optimal here, AFAIK the practice is to symlink sh to the preferred shell installed on the system.


Sys("sh -c \'echo $PATH\'");


should work.

Best regards,
Oblivion


Oh... Embarassed
I missed \' thing..
https://stackoverflow.com/questions/1250079/how-to-escape-si ngle-quotes-within-single-quoted-strings
Now, yes, it works upp way!
Btw, bash and zsh (what I am using on mac) also work and give the same results.
But your remark about the sh symlink is also very useful.

Thank you very much, Oblivion.

[Updated on: Fri, 06 January 2023 00:07]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Compilation on Linux +GUI,X11
Next Topic: Cannot link with obj generated on custom build step.
Goto Forum:
  


Current Time: Tue Apr 29 22:38:01 CEST 2025

Total time taken to generate the page: 0.04080 seconds