How do I include a shell variable in my script?

L

laredotornado

Hi,

I'm running a Python script on a Solaris 9 machine, invoking the
Python script from ksh, if that matters. There is an enviornment
variable, $JAVA_HOME, that I would like to include in my script,
replacing "/path/to/java/home'" with the value of $JAVA_HOME.

java_home='/path/to/java/home'

How do I do this? If I need to pass a command line argument, so be
it, but I figure there is a more direct way to get the value.

Thanks, - Dave
 
J

Jerry Hill

Hi,

I'm running a Python script on a Solaris 9 machine, invoking the
Python script from ksh, if that matters. There is an enviornment
variable, $JAVA_HOME, that I would like to include in my script,
replacing "/path/to/java/home'" with the value of $JAVA_HOME.

java_home='/path/to/java/home'

import os
java_home = os.environ['JAVA_HOME']
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top