bat
bat copied to clipboard
Allow bat to replace variables on text
Something like this:
This is your home: ${HOME}
should be replaced automatically by the env variable HOME
I personally feel like having this happen automatically would not be desired at all, as it could be highly confusing. Especially when looking at a config file for something which would actually be deployed to a different environment. Perhaps some wrapper script to pre-process it would suffice?
I'm with @keith-hall on this. Automatically expanding environment variables will likely cause confusion, even in code.
function newTempFile($tmpdir) {
$file = fopen("${tmpdir}/file.txt", "w");
if ($file === false) {
// do something
}
return $file;
}
If environment variables were replaced, it would lead the user into thinking the new temporary file is located at /tmp
instead of the directory specified as the function parameter.
A preprocessing step would be a better place to do environment variable expansion.