Sponsored Content
Top Forums Shell Programming and Scripting how to set/get shell env variable in python script Post 302577229 by felipe.vinturin on Monday 28th of November 2011 11:44:55 AM
Old 11-28-2011
In the same way as you are doing as a command line argument:
Code:
def getEnvVarValue(envVar):
    tmpVal = os.getenv(envVar)
    if not tmpVal:
        print("Environment variable: [%s] not set." % (envVar))
        sys.exit(1)
        
    retValue = tmpVal.strip("'") 
    return retValue


Bin=getEnvVarValue('BIN')
mpdCmd="%s/%s/mpd" % (MPI_ROOTDIR, Bin)
mpdtraceCmd="%s/%s/mpdtrace" % (MPI_ROOTDIR, Bin)
mpdtraceCmd2="%s/%s/mpdtrace -l" % (MPI_ROOTDIR, Bin)

I hope it helps!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is there any way to set env variable in top level Makefile and unset when done

Hello I have compilation directory structure the top level Makefile is the one that contains all the sub directories I want to set in this Makefile env variable say : setenv OPTIMIZATION_LEVEL "1" and when all the sub directories done compiling it will set this variable to different lavel... (0 Replies)
Discussion started by: umen
0 Replies

2. AIX

Do I need to reboot after installation of s/w and set the env variable

Hi, I have installed ODWEK software on AIX box and set the environment variables like: PATH,LIBPATH,LD_LIBRARY_PATH,CLASSPATH. My question here is do I need to reboot the system to take these changes or is there anyother workaround. I heard that there is 'export'. But I don't know how far it... (1 Reply)
Discussion started by: srangu
1 Replies

3. AIX

Do I need to remote after installation of s/w and set the env variable

Hi, I have installed ODWEK software on AIX box and set the environment variables like: PATH,LIBPATH,LD_LIBRARY_PATH,CLASSPATH. My question here is do I need to reboot the system to take these changes or is there anyother workaround. I heard that there is 'export'. But I don't know how far it... (1 Reply)
Discussion started by: srangu
1 Replies

4. Shell Programming and Scripting

problem in getting the path of environment variable set in bashrc in my shell script

hi all i have joined new to the group. i have set an variable in my bashrc file. .bashrc PROGHOME=/home/braf/braf/prog export PROGHOME but while using it in my shell script its path is not taken and i had to explicitly give the export command to set the path. in my script... (8 Replies)
Discussion started by: krithika
8 Replies

5. Shell Programming and Scripting

get env variable from last script

I have 2 scripts t2.sh calls t1.sh. I need to get the vaule of a env variable from t1.sh /tmp/test$ cat t1.sh #!/bin/sh INSTANCE="font/fc-cache" export INSTANCE svcadm disable ${INSTANCE} /tmp/test$ cat t2.sh #!/bin/sh . /tmp/test/t1.sh echo ${INSTANCE} The above works... (9 Replies)
Discussion started by: honglus
9 Replies

6. UNIX for Advanced & Expert Users

How to export ENV variables, which remains set for all the shell

Hi ! How to export ENV variables, which remains set for all the shell Example :- Login :myID Pwd : **** -> Here my ID .profile is executed. Let say I set MYENV variable Kisses% rlogin ABC -l XXXGroupID -> I login into a remote Solaris Server ABC password : **** -> "XXXGroupID's... (1 Reply)
Discussion started by: dashok.83
1 Replies

7. Shell Programming and Scripting

Set/Export Env Vars from with Shell Script With Input Variable

I have a shell script I want to run that will set environment variables based on the value of an input variable submitted when the shell script is called. For example: $ mgenv.sh prod This would set environment variables for prod $ mgenv.sh test This would set environment variables... (1 Reply)
Discussion started by: brtaylor73
1 Replies

8. Shell Programming and Scripting

Passing variable from shell script to python script

I have a shell script main.sh which inturn call the python script ofdm.py, I want to pass two variables from shell script to python script for its execution. How do i achieve this ????? Eg: main.sh a=3 b=3; c= a+b exec python ofdm.py ofdm.py d=c+a Thanks in Anticipation (4 Replies)
Discussion started by: shashi792
4 Replies

9. Web Development

Deny from env=env-variable Does not work

(Above from Apache docs). On my system, using: SetEnvIf User-Agent Mozilla IsBad=1 Order allow,deny Allow from all Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Discussion started by: gnurob
1 Replies

10. Shell Programming and Scripting

Bash script - ENV Variable context problem using su

Hello I have found some piece of code to verify and then run shell script with root permission from normal user. see : http://blog.mecworks.com/articles/2006/02/23/bash-scripting-tip-running-a-script-as-root I have wrote two scripts using this tips. - one to copy file from server to local... (6 Replies)
Discussion started by: jcdole
6 Replies
DateTime::Locale::xh(3) 				User Contributed Perl Documentation				   DateTime::Locale::xh(3)

NAME
DateTime::Locale::xh SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'xh' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Xhosa. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) Mvulo Lwesibini Lwesithathu Lwesine Lwesihlanu Mgqibelo Cawe Abbreviated (format) Mvu Bin Tha Sin Hla Mgq Caw Narrow (format) Mvu Bin Tha Sin Hla Mgq Caw Wide (stand-alone) Mvulo Lwesibini Lwesithathu Lwesine Lwesihlanu Mgqibelo Cawe Abbreviated (stand-alone) Mvu Bin Tha Sin Hla Mgq Caw Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) Janyuwari Februwari Matshi Epreli Meyi Juni Julayi Agasti Septemba Okthoba Novemba Disemba Abbreviated (format) Jan Feb Mat Epr Mey Jun Jul Aga Sep Okt Nov Dis Narrow (format) Jan Feb Mat Epr Mey Jun Jul Aga Sep Okt Nov Dis Wide (stand-alone) Janyuwari Februwari Matshi Epreli Meyi Juni Julayi Agasti Septemba Okthoba Novemba Disemba Abbreviated (stand-alone) Jan Feb Mat Epr Mey Jun Jul Aga Sep Okt Nov Dis Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) 1 unyangantathu 2 unyangantathu 3 unyangantathu 4 unyangantathu Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) 1 unyangantathu 2 unyangantathu 3 unyangantathu 4 unyangantathu Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BC umnyaka wokuzalwa kukaYesu Abbreviated BC AD Narrow BC AD Date Formats Full 2008-02-05T18:30:30 = Lwesibini, 2008 Februwari 05 1995-12-22T09:05:02 = Lwesihlanu, 1995 Disemba 22 -0010-09-15T04:44:23 = Mgqibelo, -10 Septemba 15 Long 2008-02-05T18:30:30 = 2008 Februwari 5 1995-12-22T09:05:02 = 1995 Disemba 22 -0010-09-15T04:44:23 = -10 Septemba 15 Medium 2008-02-05T18:30:30 = 2008 Feb 5 1995-12-22T09:05:02 = 1995 Dis 22 -0010-09-15T04:44:23 = -10 Sep 15 Short 2008-02-05T18:30:30 = 2008-02-05 1995-12-22T09:05:02 = 1995-12-22 -0010-09-15T04:44:23 = -010-09-15 Default 2008-02-05T18:30:30 = 2008 Feb 5 1995-12-22T09:05:02 = 1995 Dis 22 -0010-09-15T04:44:23 = -10 Sep 15 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = Lwesibini, 2008 Februwari 05 18:30:30 UTC 1995-12-22T09:05:02 = Lwesihlanu, 1995 Disemba 22 09:05:02 UTC -0010-09-15T04:44:23 = Mgqibelo, -10 Septemba 15 04:44:23 UTC Long 2008-02-05T18:30:30 = 2008 Februwari 5 18:30:30 UTC 1995-12-22T09:05:02 = 1995 Disemba 22 09:05:02 UTC -0010-09-15T04:44:23 = -10 Septemba 15 04:44:23 UTC Medium 2008-02-05T18:30:30 = 2008 Feb 5 18:30:30 1995-12-22T09:05:02 = 1995 Dis 22 09:05:02 -0010-09-15T04:44:23 = -10 Sep 15 04:44:23 Short 2008-02-05T18:30:30 = 2008-02-05 18:30 1995-12-22T09:05:02 = 1995-12-22 09:05 -0010-09-15T04:44:23 = -010-09-15 04:44 Default 2008-02-05T18:30:30 = 2008 Feb 5 18:30:30 1995-12-22T09:05:02 = 1995 Dis 22 09:05:02 -0010-09-15T04:44:23 = -10 Sep 15 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 Bin 1995-12-22T09:05:02 = 22 Hla -0010-09-15T04:44:23 = 15 Mgq Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = Bin, 2-5 1995-12-22T09:05:02 = Hla, 12-22 -0010-09-15T04:44:23 = Mgq, 9-15 MMM (LLL) 2008-02-05T18:30:30 = Feb 1995-12-22T09:05:02 = Dis -0010-09-15T04:44:23 = Sep MMMd (MMM d) 2008-02-05T18:30:30 = Feb 5 1995-12-22T09:05:02 = Dis 22 -0010-09-15T04:44:23 = Sep 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Bin Feb 5 1995-12-22T09:05:02 = Hla Dis 22 -0010-09-15T04:44:23 = Mgq Sep 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = Februwari 5 1995-12-22T09:05:02 = Disemba 22 -0010-09-15T04:44:23 = Septemba 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Bin Februwari 5 1995-12-22T09:05:02 = Hla Disemba 22 -0010-09-15T04:44:23 = Mgq Septemba 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = Bin, 2008-2-5 1995-12-22T09:05:02 = Hla, 1995-12-22 -0010-09-15T04:44:23 = Mgq, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Feb 1995-12-22T09:05:02 = 1995 Dis -0010-09-15T04:44:23 = -10 Sep yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Bin, 2008 Feb 5 1995-12-22T09:05:02 = Hla, 1995 Dis 22 -0010-09-15T04:44:23 = Mgq, -10 Sep 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 Februwari 1995-12-22T09:05:02 = 1995 Disemba -0010-09-15T04:44:23 = -10 Septemba yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 Miscellaneous Prefers 24 hour time? Yes Local first day of the week Mvulo SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.16.3 2014-06-10 DateTime::Locale::xh(3)
All times are GMT -4. The time now is 06:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy