Why global var is not global with export


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Why global var is not global with export
# 1  
Old 08-30-2011
Why global var is not global with export

Hi,
I try to define global var assuming that I can acces it from multiple sessions/terminal windows, but I can't do this with either comand line or script delcaratino/export. I'm not a root user doing this, but is this should not be matter.
Even if I do this lines below in script, being in the very same terminal session I can't see this LX_PATH value? Is it right?
I read and assumed that <export var> should take care of it.

Is it possible to make it visible somehow? my script issues this lines, and I want to have this value accros the server accessing it thru sript ot terminal. I'm on Fedora 14.

Code:
LX_PATH=dir1/dir2/dir3:dir4/dir5
export LX_PATH


Last edited by trento17; 08-30-2011 at 02:38 AM..
# 2  
Old 08-30-2011
Where do you define the above variable and export..? Try placing the variable in .profile file under home directory for it to be visible in your current session or place it in /etc/profile to be visible for any sessions. This is with respect to SuSe Linux, im not sure on Fedora. But its just an heads-up.
# 3  
Old 08-30-2011
Add to ~/.bashrc
export LX_PATH=dir1/dir2/dir3:dir4/dir5

That will make it available for you in every interactive not login shell, and in any login session as long as ~/.bashrc is sourced in ~/.profile or ~/.bashrc_profile
# 4  
Old 08-30-2011
Thanks all guys,
Yes I see that if you make in .profile or bashrc ,it works all accross the server, but I have this declaration in one start up script which suppose to set some LX_LIBRARY path for odbc connection and surely it doesn't work, so I'm checking this. Not sure in what cases <export var> from the shell can help, only for children processes and within same term session?
If script starts by cron, who can use this var?

I also confused with explanation for "how to make var global", on www it says that <export> will do the job.
something like from http://scofaq.aplawrence.com/FAQ_scotec6global.html
Quote:
MYVAR="hello"
export MYVAR

Best
T
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Date and time change in global and non global zone

Hi, If I change date and time in global zone, then it will affect in non global zones. During this process what files will get affect in non global zones and which mechanism it's using to change. gloabl zone:Solaris 11.3 X86 TIA (1 Reply)
Discussion started by: Sumanthsv
1 Replies

2. Shell Programming and Scripting

Array - Export/Import in global environment variables.

Hello. During startup /etc/bash.bashrc.local generates some array ..... source /.../.../system_common_general_array_env_var ..... The file system_common_general_array_env_var contains : LEAP_VERSION='42.3' ARRAY_MAIN_REPO_LEAP=('zypper_local' 'openSUSE-Leap-'"$LEAP_VERSION"'-Non-Oss' ... (2 Replies)
Discussion started by: jcdole
2 Replies

3. Solaris

Global and non-global zone resource sharing - tricky

hi all, Just a simple question but i cant get the answers in the book - In my globalzone , assuming i have 4 cpus (psrinfo -pv = 0-3), if i set dedicated-cpu (ncpus=2) for my local zone Is my globalzone left with 2 cpus or still 4 cpus ? Does localzone "resource reservation.e.g. cpu in... (6 Replies)
Discussion started by: javanoob
6 Replies

4. UNIX for Dummies Questions & Answers

How to Export Glance "Global System Calls" data to a file

Hello... I'm trying to setup a cronjob to record system data using glance at certain times of the day. My question is, how would one export the "Global System Calls" information to a file? Below is the command I have been using and it works to export CPU information. glance -f ... (0 Replies)
Discussion started by: fumus
0 Replies

5. Solaris

How to identify a global or non-global Solaris server?

Hi, I have Solaris zone configured with Solaris 9 and 10. In Solaris 10(non global), I use the command “zonename” to get whether it is global or non-global server. For Solaris 9, what command I can use to get whether it is global or non-global server. Regards, Kalai :confused: (25 Replies)
Discussion started by: kalpeer
25 Replies

6. Solaris

How to see global hostname by logging in non global zones?

Hi guru Could any one help me by letting me know, how to see global hostname by logging in non global zones Regards (2 Replies)
Discussion started by: girish.batra
2 Replies

7. Solaris

How to access ENV variables of non global zones in global zone???

Hi Guys, My requirement is I have file called /opt/orahome/.profile in non global zone. PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:. export PATH PS1="\${ORACLE_SID}:`hostname`:\$PWD$ " export PS1 EDITOR=vi export EDITOR ENV=/opt/orahome/.kshrc export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies

8. Solaris

Is there two different kernel`s running in global and non global zone?

Hi All, I want to know for non global zone there will be different kernal running? (1 Reply)
Discussion started by: vijaysachin
1 Replies

9. Solaris

How can we copy a directory from Global to Non-global zone?

Hi All, How can we copy a directory from global zone to non-global zone using SCP command? (8 Replies)
Discussion started by: vijaysachin
8 Replies

10. Solaris

How to know the global zonename from non-global zone?

It is easy to list all zones from global zones, but how to find out the global zone name from non-global zone? thx (11 Replies)
Discussion started by: honglus
11 Replies
Login or Register to Ask a Question