environment-variables

save and restore shell variables

I have two shell scripts that I'd like to invoke from a C program. I would like shell variables set in the first script to be visible in the second. Here's what it would look like: a.sh: var=blah <save vars> b.sh: <restore vars> echo $var The best I've come up with so far is a variant on "set > /tmp/vars" to save the variables and...

How can I tell from a within a shell script if the shell that invoked it is an interactive shell?

I'm trying to set up a shell script that will start a screen session (or rejoin an existing one) only if it is invoked from an interactive shell. The solution I have seen is to check if $- contains the letter "i": #!/bin/sh -e echo "Testing interactivity..." echo 'Current value of $- = '"$-" if [ `echo \$- | grep -qs i` ]; then echo ...

PYTHONPATH and PHP

I have a PHP script that call a python script (someone else I can't edit). This work fine on CLI but once I run it as CGI it fails with the error "bzr: ERROR: Couldn't import bzrlib and dependencies." I guessed it has anything to do with PYTHONPATH so I echo it out and found that it was empty when in apache environment. I try setting i...

Create and deploy environment-specific war builds for Tomcat during same build

I want to be able to build a war file and deploy it in multiple environments. I know I can create an ant task to get the environment and either include the files in the war, or replace the tokens as necessary. However, this would lead to as many different war files as environments (dev, QA, DR, prod, etc...). It seems that this would ...

Using getenv function in Linux

I have this following simple program: int main() { char* v = getenv("TEST_VAR"); cout << "v = " << (v==NULL ? "NULL" : v) << endl; return 0; } These lines are added to .bashrc file: TEST_VAR="2" export TEST_VAR Now, when I run this program from the terminal window (Ubuntu 10.04), it prints v = 2. If I run the program ...

How to construct a comma-separated string in Bourne shell?

Hello, I'm not sure how to do this but I figured I would ask here.. I'm trying to create a string of specific environment variables such that: $A = "foo" $B = "bar" $C = "baz" would give "foo, bar, baz" Unfortunately, it doesn't seem that the Bourne shell supports arrays, which would have made these easily solvable. The other way I'm...

$_COOKIE[] will not accept string with periods?

<?php $Test = "dsdsdad.dsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITH A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*3); } $Test = "dsdsdaddsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITHOUT A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*...

Make an environment variable survive ENDLOCAL

I have a batch file that computes a variable via a series of intermediate variables: @echo off setlocal set base=compute directory set pkg=compute sub-directory set scripts=%base%\%pkg%\Scripts endlocal %scripts%\activate.bat The script on the last line isn't called, because it comes after endlocal, which clobbers the scripts envir...

Are environment variables available to FlashBuilder?

I'm not sure I'm using the right terms. Long ago I tinkered with Eclipse and recall there were "environment variables" that could be specified in project settings and compiler directive fields in the GUI itself to customize builds. I believe the syntax was similar to ant properties, like ${env.HOME} for inserting the user's home direct...

how to ensure that VSVARS32.BAT batch file have permanent effect?

If I need to use microsoft C# compiler from the normal command prompt, it says right here how and it says right here how I set the environment variable (by running VSVARS32.BAT). I execute it and after that I can run "csc" (the compiler). However the effect seems to disappear when I close the command line window that run VSVARS32.BAT Is...

DllNotFoundException libpjsipDll Mono

Hi everybody, I've a problem to execute a program with Mono in the terminal, (mono program.exe). An error appears : "System.DllNotFoundException : libpjsipDll.so " however my library exists and I've setted my 2 environment variables : LD_LIBRARY_PATH and MONO_PATH in the directory where the file is. I don't understand why this error o...

"HTTP_USER_AGENT" not working. nothing is displayed in my browser i.e. firefox

<?php $agent=getenv("HTTP_USER_AGENT"); if(preg_match("/MSIE/i", "$agent")){ $result="You are using Microsoft Internet Explorer.";} else if (preg_match("/Mozilla/i", "$agent")){ $result= "You are using Firefox.";} else {$result = " you are using $agent.";} ?> <html> <head> <title>Browse Match Results</title> </head> <bod...

How do I open gnome-terminal with new enviroment variables?

I have a file that sets enviroment variables(JAVA_HOME, ANT_HOME...) I use for doing java programming related tasks. WHen I want to setup the new environment I type "source devenv" (devenv being the file that contains the new environment setup). I'm trying to create a shortcut that opens the gnome-terminal and automatically sets those va...

With Visual C++ Express 2008, the LIB environment variable is being ignored.

We are using LDRA to unit test our source code. In our case LDRA is using cl.exe and link.exe from VC++ express 2008, on several machines setting the LIB environment variable allows link.exe to find the libraries we specify, some machines ignore the LIB environment variable. Does anyone know what would cause the LIB environment variable ...

Is there an environmental variable or equivalent for WinZip?

Is there an environmental variable or equivalent for WinZip32.exe I can use to find it's location path? EDIT - This is an in house tool for a controlled system. Thanks. ...

How do I modify the PATH environment variable when running and Inno Setup Installer?

Inno Setup lets you set environment variables via the [Registry] sections (by setting registry key corresponding to environment variable) However, sometimes you dont just wanna set an environment variable. Often, you wanna modify it. For example: upon installation one may want to add/remove a directory to/from the PATH environment varia...

How to access the ProgramFiles environment variable from nmake on x64 machines?

I try to get the path to the ProgramFiles environmental variable, that is supposed to expand to C:\Program Files (x86) on a x64 machine and to C:\Program Files on a x86 machine. The problems is that in the nmake file if I do: all: echo $(PROGRAMFILES) This will expand to C:\Program Files everytime and this is wrong. Environme...

Java classpath, class not found

I'm trying to be able to do homework on my work computer for a Java class. I see an old jdk is installed and I created a .bat to have my environment variables set up. I can do a simple "HelloWord" example, but now when I try to do a simple example where I create a FileOutputStream object, I get class not found on my FileOutputStream. ...

Makefile target depend on file from environment variable

hi, if I run make like this: make VAR=dir is there a way to add the location pointed by the VAR variable as a target dependency? actually, I need to define a file inside that directory as a dependency. I'd go with: target: $(VAR)/file.txt echo yes but if the variable was not defined, the target will understand /file.txt, which ...

Add to $PATH in linux so that it's available to daemons

Where can I add to a $PATH so that it's available to all daemons? So that it's "included" or "sourced" before daemons start? Many thanks! ...