environment-variables

Python Vs C - Handling environment variable in Windows

Hi Guys, I see a variation in output between C and python code in Windows trying to get the same functionality. The c code ( similar to unix shell scripts ) shows the TEST1 environment variable in 'test.bat.output' with its value as empty string whereas the python code removes this environment variable. Is there a way to ask Python ...

Using web services in different environments

We have a series of web services that live in different environments (dev/qa/staging/production) that are accessed from a web application, a web site, and other services. There are a few different service areas as well. So for production, we have services on four different boxes. We conquered the db connection string issue by checking...

Using Sed to expand environment variables inside files

I'd like to use Sed to expand variables inside a file. Suppose I exported a variable VARIABLE=something, and have a "test" file with the following: I'd like to expand this: "${VARIABLE}" I've been trying commands like the following, but to no avail: cat test | sed -e "s/\(\${[A-Z]*}\)/`eval "echo '\1'"`/" > outputfile The result i...

How do I find javac.exe programmatically?

I'm calling javac from C# code. Originally I found its location only as follows: protected static string JavaHome { get { return Environment.GetEnvironmentVariable("JAVA_HOME"); } } However, I just installed the JDK on a new computer and found that it didn't automatically set the JAVA_HOME environment variable. Req...

Load dll's from Environment Variable Path from a service

We install Matlab Runtime on a machine, then we restart a .net windows service that invokes methods from the Matlab Runtime. The problem is that we receive TypeInitializationException errors until we restart windows. We think this happens because Environment Variables are not changed on services until restart and Matlab uses the %Path% v...

Getting $USER inside shell script when running with sudo ?

Hi, How do I get the correct $USER if I run a shell script with sudo ? I run them as postinstall scripts in a Mac install package, where they are being sudo-ed automatically, but I need to do stuff with the username. $HOME is correct, though. The inelegant method would be to extract the name from the home path, but I wonder if there ...

I want to create this environment variable for everyone, but it does not load during startup? (linux)

I put this at the top, using "sudo vi /etc/profile": PYTHONPATH=/home/myuser:/home/myotheruser When I use putty and log in under my username, the python path does not work! I type "set", and it is there. But, importing things from that directory still does not work. When I manually do this, then it will work. EXPORT PYTHONPATH=/home...

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 ...

setven in launchd.conf on mac

Hello good people This is my first real development with the mac os(OS X 10.5.8).I got a macbookpro from work and i'm still setting up the right development environment.I've opted for the creation of /etc/launchd.conf and it's working fine for most of my librairies (JAVA_HOME, JRE_HOME) i now need to add CATALINA_OPTS=-Duser.timezone=Asi...

How do I setup environment variable INCLUDE for Visual Studio 2005?

Is there a script that I can run that will setup my %INCLUDE% environment variable? I'm running PC-lint and it can't find my include header files. I went through the documentation and it appears that I need to setup the %INCLUDE% environment variable. I was wondering if there's an easy way to do it. ...

Can't Run Netbeans after changing Java to 1.6 on mac

Hello guys i know i've posting a lot about mac lately and setting up my environment to develop on java 1.6. after trying to set my etc/launch.conf like so setenv JAVA_VERSION 1.6 setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/ setenv CATALINA_BASE /Library/apache-tomcat6020 setenv CATALINA_HOM...

Python: Platform independent way to modify PATH environment variable

Is there a way to modify the PATH environment variable in a platform independent way using python? Something similar to os.path.join()? ...

Environment variable used in shell script appear blank in log file when run by cron

Forgive my ignorance, but I am somewhat new to shell scripting and the use of environment variables in Linux. I have a script that performs a backup of a MySQL database. I have the following lines in the script that are used to log a successful dump of the database: output=`date; echo "Database export successful from $ENV_HOSTNAME to ...

Setting Enviroment Variables Dynamically on Linux

I am currently looking for a way to set enviroment variables in Linux via a simple shell script. Within the script I am currently using the 'export' command, however this only has scope within the script where system-wide scope is needed. Is there anyway I can do this via a shell script, or will another method need to be used? ...

suggestions for using PATH to executables with version control (Mercurial)

So I'm pretty new to version control but I'm trying to use Mercurial on my Mac to keep a large Python data analysis program organized. I typically clone my main repository, tweak the clone's code a bit, and run the code on my data. If the changes were successful I commit and eventually push the changes back to my main repository. I gu...

How do I set an environment variable in Perl?

How do I set an environment variable in Perl? I want to set $HOME to a different directory than the default. ...

Within a windows batch file, how do I set an environment variable with the hexadecimal representation of a decimal number?

When using the Windows set /p and set /a commands to accept a hexadecimal value from the command line and convert it to decimal. What I need is to be able to take a decimal value and set and environment variable with its hexadecimal equivalent. Current batch file coding: @echo off set HexV1=%1 set HexV2=%2 set /A DecV1=0x%HexV1% set /A...

Best way to configure a run script?

I am tasked with supportting a run script that uses environment variables to determine which tools to use, which directories to grab source files from, etc. This does not seem like the best technique to me. It seems like it would be much better to have configuration files that set all these things and have the run script parse this inste...

LINES and COLUMNS environmental variables lost in a script

Consider the following: me@mine:~$ cat a.sh #!/bin/bash echo "Lines: " $LINES echo "Columns: " $COLUMNS me@mine:~$ ./a.sh Lines: Columns: me@mine:~$ echo "Lines: " $LINES Lines: 52 me@mine:~$ echo "Columns: " $COLUMNS Columns: 157 me@mine:~$ The variables $LINES and $COLUMNS are shell variables, not environmental variables, and ...

[Ant] How to export environment variable from exec task ?

Hi, I am using Ant under WinXp to build MSVisual c++ projects. To access "devenv.com", being computer-independent, I would like to use the vsvars32.bat script. Unfortunately, it seems that env vars are defined only in the "exec" scope. Example: <exec executable='"${env.VS90COMNTOOLS}vsvars32.bat/> <echo message="${DevEnvDir}" /> <ec...