what is the best way to extend (or evaluate) the file path contains an environment variable.
my current solution uses a regex to search for a pattern of type ${ABC}or $ABC, and then use a function getenvto get the value and replace it, but I found it a little difficult to take these exceptions into account, for example, \$HOMEor '$HOME'(in this case, the value should not be considered as env variable).
Another requirement is that if any variable is not defined, it will return these variable names undefined.
so what's any better solution? thank
source
share