LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 09-29-2008, 04:47 AM   #1
smartgupta
Member
 
Registered: Sep 2008
Posts: 81

Rep: Reputation: 15
Unhappy not able to export the Variables


I am working with Sun Solaris 9 and I want to export the environment variable from my application(xxxx.ksh) but I am not able to see it when I am using SET command

I am writing some variables which I have to set

COMMON_USER_HOME=${HOME}
export COMMON_USER_HOME
echo COMMON_USER_HOME=$COMMON_USER_HOME

export P4USER="AbcdeF"
echo P4USER=$P4USER

but when I am running my file xxxx.ksh and echoing the variable then I am able to see the output of the variable but not able to see it as exported when using set commond

# echo $SHELL
/bin/sh

COMMOM_USER_HOME=/home/User1
P4USER=AbcdeF

So Can anyone tell me what is the problem and how can I salve it

Thanks in Advance...

Last edited by smartgupta; 09-29-2008 at 05:05 AM.
 
Old 09-29-2008, 03:30 PM   #2
jan61
Member
 
Registered: Jun 2008
Posts: 235

Rep: Reputation: 46
Moin,

do you assign and export the vaiables within your shell script? In this case they don't appear in your environment, when the script is finished. The script runs in his own subshell and an export never changes the environment of the parent process.

A way to make the variables known in your shell is to source the script:
Code:
. /path/to/my/script
# or
source /path/to/my/script
If you source a script, it is executed in the current shell. But attention: Don't finish the script with an exit, this will also finish your current shell.

Jan
 
Old 09-29-2008, 04:11 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,522

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
Quote:
Originally Posted by smartgupta View Post
So Can anyone tell me what is the problem and how can I salve it
Please clearly describe a complete and detailed sequence of commands that doesn't give the result you expect.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I export my variables from a script? HGeneAnthony Debian 2 05-20-2006 05:47 PM
why do we have to export variables? learnfast Linux - Newbie 2 05-27-2005 09:27 AM
export variables alaios Linux - General 3 12-04-2004 08:33 AM
keep my export variables captain-cat Linux - Newbie 9 06-23-2004 06:22 AM
export variables radnix Linux - General 2 04-28-2004 07:52 PM


All times are GMT -5. The time now is 03:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration