By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,736 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,736 IT Pros & Developers. It's quick & easy.

How do I include a shell variable in my script?

P: n/a
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
Jul 29 '08 #1
Share this Question
Share on Google+
2 Replies

P: n/a
On Tue, Jul 29, 2008 at 10:53 AM, laredotornado
<la***********@zipmail.comwrote:
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']

--
Jerry
Jul 29 '08 #2

P: n/a
On Tue, 29 Jul 2008 07:53:53 -0700, laredotornado wrote:
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
import os

java_home = os.environ['JAVA_HOME']

** Posted from http://www.teranews.com **
Jul 30 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.