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
0
votes
3 answers

Updating PATH Variable from PHP script

Hi there I want to update Path environmental variable through PHP script. I have generated a .reg file using PHP. The content of reg file looks like [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] …
Awais Qarni
  • 121
  • 4
0
votes
1 answer

Setting Env Vars in tcsh

Please tell me why I can't set my env var by modifying ~/.profile? [104] whoami user [105]% cat .profile . /app/share/Profile # add any personal customizations after this line set JAVA_HOME="/usr/java/jdk1.6.0_17" [106]% ~/.profile user…
Kevin Meredith
  • 1,269
  • 2
  • 15
  • 21
0
votes
1 answer

Provide credentials to process in a safe manner

On system startup I need to launch a process which requires credentials for other services (database etc.) to interact. I obviously don't want to store those on disk for security reasons. I'm trying to think of a way to provide those credentials to…
user22711
0
votes
1 answer

how to check in a bash script where the shell is run from

I am fuzzy about how to set a command in a script to be run only when the shell is running within an X session. basically, in ~/.bashrc I set my keyboard maps as setxkbmap -layout 'us,gr' -variant 'altgr-intl,extended' -option…
nass
  • 568
  • 4
  • 10
  • 24
0
votes
1 answer

Changes in SetEnv directives not seen in scriptalias

I need to read an environment variable in a ScriptAlias script. So I have SetEnv directives to set these variables, in the following apache configuration. ServerName ... DocumentRoot /srv/www ServerAlias git DocumentRoot…
jolivier
  • 141
  • 1
  • 9
0
votes
2 answers

Setting LD_LIBRARY_PATH not enough?

I've edited my /etc/bashrc to set LD_LIBRARY_PATH like in my previous question that I asked. However it does not seem to be taking effect. Even though echo $LD_LIBRARY_PATH does show my modifications. And running my program:…
unixman83
  • 1,932
  • 8
  • 25
  • 33
0
votes
2 answers

BASH store values in an array and check difference of each value

[CentOS, BASH, cron] Is there a method to declare variants that would keep even when system restarts? The scenario is to snmpwalk interface I/O errors and store the values in an array. A cron job to snmpwalk again, say 5 mins later, would have…
Andrew
  • 113
  • 1
  • 5
  • 14
0
votes
1 answer

Using variables across multiple puppet windows batch scripts

In my puppet script, I have 2 calls to exec that execute different batch files exec { command => 'file1.bat' } exec { command => 'file2.bat' } If file1.bat sets an environment variable using SET SET VAR1=someVal it is not accessible from…
Jeff Storey
  • 448
  • 1
  • 7
  • 19
0
votes
2 answers

Does java respect PATH env variable when resolves .jar filename?

This is what I have in PATH: PATH=/opt/ClosureCompiler:/home/vmadmin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games There is a compiler.jar in /opt/ClosureCompiler, but when I call java -jar compiler.jar I get Unable…
zerkms
  • 431
  • 2
  • 5
  • 17
0
votes
4 answers

Tomcat 7: "Cannot locate Java Home"

Arch Linux. Servlet apparently had compatibility problems with openjdk so I uninstalled it and installed the plain jdk/jre from AUR. # /etc/rc.d/tomcat7 restart :: Stopping tomcat7 daemon [FAIL] :: Starting tomcat7 daemon [BUSY] Cannot locate Java…
Hugh Guiney
  • 245
  • 2
  • 8
  • 21
0
votes
2 answers

java_home on centos

I am using a centos virtual machine instance. I have edited the /root/.bash_profile and set the JAVA_HOME path. the changes are saved but when I type echo $JAVA_HOME, the command executes but show nothing. typing which java shows some other folder,…
user727272
  • 101
  • 1
0
votes
2 answers

Why can't a certain environment-variable be added to my bash profile?

I am having an issue with running a PHP project called Phing with Cygwin. It's not a huge problem because I can make it work but I am looking for a reason or a fix so I can do it differently. In order to have Phing work with Cygwin on my system, I…
JasonDavis
  • 2,658
  • 6
  • 25
  • 32
0
votes
1 answer

How to set env variables and run multiple commands with PsExec?

How can I run multiple commands with PsExec, and how can I export environment variables? I can run two commands by doing the below, but when I try to export an environment variable the second command errors out. Running two commands: psexec…
0
votes
1 answer

environment var not found on SuSe init.d script at boot

I've got a /etc/init.d/tomcat1 script which runs on boot on rc levels 3 and 5. This script calls /usr/local/tomcat1/bin/startup.sh on start. Although I can manually execute /usr/local/tomcat1/bin/startup.sh from console, on boot I get the following…
cherouvim
  • 794
  • 3
  • 21
  • 37
0
votes
2 answers

Commands /etc/init/boot.local get started before some environment variables get initialized

I have OpenSuse 11.4. I start some on-boot scripts inside /etc/init/boot.local. Where could I move those scripts so that they would be started after all (most) environment variables got initialized? These scripts need to be started really once, so…