Questions tagged [environment-variables]

Environment variables are configuration options that can be set in a shell or other similar environments. All programs started from within the shell can read them and configure themselves.

Environment variables are key-value-pair configuration options like KEY=valueor FOO=bar. Environment variables allow you to configure a program before it gets executed and without the need to store these variables in proprietary configuration files.

They are present on all POSIX systems (Unix, Linux, BSD, Mac OS, DOS, Windows, ...). Environment variables can be set by any shell and read by nearly any programming language.

Some programming languages allow you to set Environment variables, but they only persist within the current process. You can't set them to be visible by the calling shell. So they are not useful for inter-process communication.

410 questions
11
votes
3 answers

PYTHONPATH environment variable...how do I make every subdirectory afterwards?

I currently do this: PYTHONPATH=/home/$USER:/home/$USER/respository:/home/$USER/repository/python-stuff How can I make it so that the PYTHONPATH can include everything subdirectory? PYTHONPATH = /home/$USER/....and-all-subdirectories
Alex
  • 8,471
  • 26
  • 75
  • 99
11
votes
4 answers

Environment variable in /etc/environment with pound (hash) sign in the value

On Ubuntu 12.04, I have an environment variable defined in /etc/environment like this: FOO="value_before#value_after" When I ssh into the server to check the value, I get this: $ env | grep FOO FOO=value_before I'm guessing it is treating the # as…
Jaymon
  • 273
  • 2
  • 9
10
votes
1 answer

SSH: Behavior of SetEnv for TERM variable

I want to set the TERM environment variable to a different value for each of my remote machines, so i used SetEnv TERM=myTermForRemoteVar in ~/.ssh/config. The remote machine still sees TERM=myLocalTermVar. I added AcceptEnv TERM in…
Lazarus535
  • 235
  • 2
  • 6
10
votes
1 answer

%ProgramFiles% differences on 64bit Windows

From a command prompt, I get the following: >echo %ProgramFiles% C:\Program Files However, some applications (PHP in this instance, though I've seen the same behavior from within Apache's httpd.conf), it is: >php -r "echo…
ken
  • 201
  • 1
  • 2
  • 6
10
votes
1 answer

How do you set server specific ENV values in Nginx?

I am starting a project that uses environment variables to set the database connection and a couple other things. (They didn't want to use configuration files since people are careless and overwrite them). Anyway, I am using nginx and while it…
Xeoncross
  • 4,449
  • 12
  • 43
  • 56
9
votes
4 answers

Apache 2: SetEnvIf "IP Range"

In my Apache config I want to set an environment variable if I see that the visitor comes from an specific IP range. Currently I do it this way: SetEnvIfNoCase Remote_Addr "^194\.8\.7[45]\." banned=spammer-ip SetEnvIfNoCase Remote_Addr…
BlaM
  • 3,886
  • 5
  • 27
  • 28
9
votes
1 answer

ssh configuration file environment variable?

I need to login into several remote ssh servers during my admin work. I work with three different computers client side, all of them are Debian GNU/Linux systems. I keep a workspace directory where I put everything I need to do my job, and that…
Lucio Crusca
  • 420
  • 3
  • 12
  • 33
9
votes
2 answers

Configure php-fpm to access environment variables in docker

I'm running php7-fpm in a docker container. However my php scripts aren't able to access environments variables set in my docker-compose file. getenv('MY_ENV_VAR') returns FALSE. I've changed /etc/php/7.0/fpm/pool.d/www.conf to include clear_env =…
Aidan Ewen
  • 291
  • 1
  • 4
  • 11
9
votes
1 answer

Tomcat service does not see $JAVA_HOME

I'm trying to setup a Tomcat service with Systemd on CentOS 7. I've installed Oracle Java 1.8u74 to /usr/java/jdk1.8.0_74 and set the environment variable $JAVA_HOME at boot like so: # echo "export JAVA_HOME=/usr/java/jdk1.8.0_74" >…
isapir
  • 233
  • 1
  • 2
  • 9
9
votes
3 answers

Passing variables to use in the preseed file for a Debian Jessie installation

Is it possible to add a variable via the boot prompt to the Debian installer, so that variable can be used in a preseed file? In particular, I'm trying to solve the following problem: We have a pretty extensive post-install script that is generally…
Tim Stoop
  • 588
  • 5
  • 20
9
votes
4 answers

"service"-command and environment variables

I am trying to start a service that requires a env. variable to be set to certain path. I set this variable in "/etc/profile.d/". However when I start this service using the service command, it doesn't work. man service: service runs a System V…
Esa Varemo
  • 581
  • 3
  • 8
  • 21
9
votes
3 answers

Excluding Environment Variables from ZSH Autocomplete

Quick example: ~ $ wor ~ $ WORDCHARS= …
Bryan Veloso
  • 193
  • 6
8
votes
1 answer

Is there a way to control where a windows update extracts temporary files?

Working on a vendor built system, we've realized that OS partition (C:) they created was rather small (38 GB). The object is to update Windows 2008 R2 to SP1. Several sources state that 8 GB is needed during the install process which includes…
8
votes
2 answers

Setting Server Variables before Apache Loads

We have CentOS with Apache running on it. Basically, I have a few variables in /etc/environment and they're passed through to our Apache configs using PassEnv. The issue is that because Apache is before /etc/environment the variables are not…
Steve Griff
  • 243
  • 1
  • 2
  • 5
8
votes
1 answer

Setting %PATH% for a service?

I have a service which is installed that runs and executes certain commands periodically. It runs as the Local System account. The source code for the service is not under my control, but I do control the Windows XP SP3 box that the service is…
Kyle Kaitan
1 2
3
27 28