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

10722 questions
2477
votes
15 answers

How to access environment variable values?

I set an environment variable that I want to access in my Python application. How do I get its value?
Amit Yadav
  • 27,106
  • 6
  • 36
  • 46
1797
votes
5 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.
  • 26,873
  • 15
  • 44
  • 74
1389
votes
7 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
  • 46,729
  • 19
  • 69
  • 96
1255
votes
30 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
  • 12,796
  • 4
  • 14
  • 12
1000
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
  • 49,868
  • 15
  • 89
  • 95
951
votes
14 answers

How do I pass environment variables to Docker containers?

I'm new to Docker, and it's unclear how to 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
  • 26,232
  • 17
  • 72
  • 110
873
votes
31 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
  • 55,730
  • 52
  • 115
  • 144
853
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
  • 8,641
  • 3
  • 14
  • 9
797
votes
13 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
  • 8,191
  • 3
  • 14
  • 5
679
votes
38 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
  • 6,962
  • 3
  • 15
  • 13
576
votes
18 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
  • 16,405
  • 16
  • 70
  • 105
542
votes
24 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
  • 44,080
  • 43
  • 148
  • 200
537
votes
16 answers

Set environment variables on Mac OS X Lion

When someone says "edit your .plist file" or "your .profile" or ".bash_profile" etc, this just confuses me. I have no idea where these files are, how to create them if I have to do that, etc, and also why there seem to be so many different ones…
Anders
  • 12,086
  • 23
  • 97
  • 148
495
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
  • 49,653
  • 18
  • 119
  • 157
476
votes
20 answers

'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
  • 15,110
  • 12
  • 60
  • 97
1
2 3
99 100