Questions tagged [environment-variables]

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.

Environment variables are a set of dynamic-named values that can affect the way running processes will behave on a computer. They can be said in some sense to create the operating environment in which a process runs. For example, an environment variable with a standard name can store the location that a particular computer system uses to store temporary files—this may vary from one computer system to another. A process which invokes the environment variable by (standard) name can be sure that it is storing temporary information in a directory that exists and is expected to have sufficient space.

https://en.wikipedia.org/wiki/Environment_variable

13704 questions
3148
votes
16 answers

How can I access environment variables in Python?

How can I get the value of an environment variable in Python?
Amit Yadav
  • 32,664
  • 6
  • 42
  • 57
2285
votes
7 answers

How do I delete an exported environment variable?

Before installing gnuplot, I set the environment variable GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src. During the installation, something went wrong. I want to remove the GNUPLOT_DRIVER_DIR environment variable. How can I achieve it?
A. K.
  • 34,395
  • 15
  • 52
  • 89
1532
votes
9 answers

Read environment variables in Node.js

Is there a way to read environment variables in Node.js code? Like for example Python's os.environ['HOME'].
Jayesh
  • 51,787
  • 22
  • 76
  • 99
1416
votes
36 answers

How to get the client IP address in PHP

How can I get the client IP address using PHP? I want to keep record of the user who logged into my website through his/her IP address.
Anup Prakash
  • 14,406
  • 4
  • 17
  • 12
1309
votes
21 answers

How do I pass environment variables to Docker containers?

How can one access an external database from a container? Is the best way to hard code in the connection string? # Dockerfile ENV DATABASE_URL amazon:rds/connection?string
AJcodez
  • 31,780
  • 20
  • 84
  • 118
1152
votes
9 answers

List all environment variables from the command line

Is it possible to list all environment variables from a Windows' command prompt? Something equivalent to PowerShell's gci env: (or ls env: or dir env:).
Nicola Cossu
  • 54,599
  • 15
  • 92
  • 98
1149
votes
20 answers

How to set environment variables in Python?

I need to set some environment variables in the Python script and I want all the other scripts that are called from Python to see the environment variables' set. If I do, os.environ["DEBUSSY"] = 1 it complains saying that 1 has to be a string. I…
prahallada
  • 11,741
  • 4
  • 16
  • 6
1073
votes
50 answers

Set environment variables from file of key/value pairs

TL;DR: How do I export a set of key/value pairs from a text file into the shell environment? For the record, below is the original version of the question, with examples. I'm writing a script in bash which parses files with 3 variables in a certain…
hugo19941994
  • 10,942
  • 3
  • 17
  • 13
942
votes
4 answers

What are the special dollar sign shell variables?

In Bash, there appear to be several variables which hold special, consistently-meaning values. For instance, ./myprogram &; echo $! will return the PID of the process which backgrounded myprogram. I know of others, such as $? which I think is the…
Z Douglas
  • 9,531
  • 3
  • 16
  • 9
931
votes
33 answers

Setting environment variables on OS X

What is the proper way to modify environment variables like PATH in OS X? I've looked on Google a little bit and found three different files to edit: /etc/paths ~/.profile ~/.tcshrc I don't even have some of these files, and I'm pretty sure that…
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146
714
votes
4 answers

In a Dockerfile, How to update PATH environment variable?

I have a dockerfile that download and builds GTK from source, but the following line is not updating my image's environment variable: RUN PATH="/opt/gtk/bin:$PATH" RUN export PATH I read that that I should be using ENV to set environment values,…
ILikeTacos
  • 17,464
  • 20
  • 58
  • 88
706
votes
22 answers

Adding a directory to the PATH environment variable in Windows

I am trying to add C:\xampp\php to my system PATH environment variable in Windows. I have already added it using the Environment Variables dialog box. But when I type into my console: C:\>path it doesn't show the new C:\xampp\php…
Netorica
  • 18,523
  • 17
  • 73
  • 108
664
votes
29 answers

Is there a command to refresh environment variables from the command prompt in Windows?

If I modify or add an environment variable I have to restart the command prompt. Is there a command I could execute that would do this without restarting CMD?
Eric Schoonover
  • 47,184
  • 49
  • 157
  • 202
637
votes
23 answers

Error "'git' is not recognized as an internal or external command"

I have an installation of Git for Windows, but when I try to use the git command in Command Prompt, I get the following error: 'git' is not recognized as an internal or external command, operable program or batch file. How do I fix this problem?
Jason Kim
  • 18,102
  • 13
  • 66
  • 105
593
votes
4 answers

Defining and using a variable in batch file

I'm trying to define and use a variable in a batch file. It looks like it should be simple: @echo off set location = "bob" echo We're working with "%location%" The output I get is the following: We're working with "" What's going on here? Why is…
Jamie Dixon
  • 53,019
  • 19
  • 125
  • 162
1
2 3
99 100