environment-variables

Interpolating environment variables in string

别来无恙 提交于 2020-01-25 00:19:08
问题 I need to expand environment variables in a string. For example, when parsing a config file, I want to be able to read this... statsFile=${APP_LOG_DIR}/app.stats And get a value of "/logs/myapp/app.stats", where the environment variable APP_LOG_DIR = "/logs/myapp". This seems like a very common need, and things like the Logback framework do this for their own config files, but I have not found a canonical way of doing this for my own config files. Notes: This is not a duplicate of the many

How do I set an environment variable on macOs Mojave?

跟風遠走 提交于 2020-01-24 20:52:26
问题 I'm installing 'THERMUS: A Thermal Model Package for ROOT' on macOs Mojave. One of the steps is (after unzipping) the following: "Set an environment variable `THERMUS' to point at the top-level directory containing the THERMUS code". I really don't know what to do. I've seen the other post on stackoverflow: 'no rule to make target' with no reason, but, as I am a beginner, I really don't understand how I should set it. Please help me 回答1: To set an environment variable on Mac OSX, first open a

Environment variables not set when running Java integration tests

本小妞迷上赌 提交于 2020-01-24 20:37:13
问题 When running our Java integration tests for a basic GET service, our application code cannot retrieve environment variables. However when we run the application itself it can retrieve the variables without issue. We are developing on a Mac (el captiain) with intellij as our IDE. We have exported the variables in our bash_profile (e.g. export ORACLE_URL="*************"). And we can echo the variable after setting and refreshing. We are completely stumped as to why they work during a gradlew

How to set environment variables for bash from within powershell?

大兔子大兔子 提交于 2020-01-24 20:30:07
问题 Using powershell how do I set the environment variables (here, particularly "ApiSecret") so that printenv will show the necessary variables? (Operating on the assumption that the problem is that Visual Studio and bash aren't picking up the environment variables properly. They can be set from bash easily enough.) I'm on Linux: thufir@dur:~/powershell/helloPSTwitterAPI$ thufir@dur:~/powershell/helloPSTwitterAPI$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:

IntelliJ Tomcat Run Configuration Does Not Set Environment Variables

会有一股神秘感。 提交于 2020-01-24 20:28:45
问题 I am running Tomcat 8.0.35 on OS X with IntelliJ Ultimate 2016.1.2. I want to run Tomcat locally under the debugger and deploy my web application to it. I created a local Tomcat Server run configuration. In the Deployment tab I specified the WAR file to deploy. My web application requires REDIS_HOST_MM and REDIS_PORT_MM environment variables to be set. I set these in the Startup/Connection tab of the run configuration. Tomcat starts and my web application deploys, however, the environment

How do I ensure C#'s Process.Start will expand environment variables?

泪湿孤枕 提交于 2020-01-24 02:25:28
问题 I'm attempting to create a process like so: var psi = new ProcessStartInfo { FileName = @"%red_root%\bin\texturepreviewer.exe", UseShellExecute = true }; var process = Process.Start(psi); process.WaitForExit(); Now the environment variable "red_root" definitely exists in the spawned process' environment variables, but the execute doesn't seem to expand the environment variable and so the file isn't found. How can I get the Process.Start to expand the environment variable in the file name? 回答1

Setting a java ProcessBuilder environment with a bash script

点点圈 提交于 2020-01-24 00:39:27
问题 I've been using ProcessBuilder to successfully invoke a process with various environment variables using env.put("VAR","value") . Now I'd like to source some bash scripts to set a whole bunch of environment variables that are not predetermined within java. Anyone know of an easy way to do this? 回答1: bash supports the environment variable BASH_ENV on startup. Set the variable to your script and its contents will be sourced before execution. See bash(1) for details. 回答2: If your "batch scripts"

Setting environments variables from a python script

二次信任 提交于 2020-01-23 17:30:09
问题 I am using c-shell and I am used to using setenv. I need to execute an equivalent command from within a python script. I tried using os.environ['JAVA_HOME'] = "/usr/local/java" which works from the python interpreter, but when my script is executed from the command line, the shell it ran in does reflect the newly set environment variable. Can anybody help, I am new to scripting, I hope I made my question clear. 回答1: If you're using subprocess.Popen, it should be enough to pass the env

automake Environment Variable Condition

家住魔仙堡 提交于 2020-01-23 13:34:31
问题 I have a file Makefile.am I am using to generate a Makefile. In the generated Makefile I want to have something like: ifndef SOURCECODEPATH SOURCECODEPATH := /home/root/source_code_path endif It seems so simple, does anyone know how I can do it? 回答1: Use the AM_CONDITIONAL macro in configure.ac . The script sets a variable you can test, e.g., a variable that is set to non-empty if the condition is enabled: AM_CONDITIONAL([ENABLE_SOURCECODEPATH], [test "x$ac_srcpath" != "x"]) Then in Makefile

automake Environment Variable Condition

半腔热情 提交于 2020-01-23 13:33:45
问题 I have a file Makefile.am I am using to generate a Makefile. In the generated Makefile I want to have something like: ifndef SOURCECODEPATH SOURCECODEPATH := /home/root/source_code_path endif It seems so simple, does anyone know how I can do it? 回答1: Use the AM_CONDITIONAL macro in configure.ac . The script sets a variable you can test, e.g., a variable that is set to non-empty if the condition is enabled: AM_CONDITIONAL([ENABLE_SOURCECODEPATH], [test "x$ac_srcpath" != "x"]) Then in Makefile