The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to convert byteArray variables to HexaString variables for Linux? ritesh_163 High Level Programming 2 08-11-2008 12:55 AM
script to export variables aboxilica Shell Programming and Scripting 1 02-20-2008 07:15 AM
export??? Justinkase Shell Programming and Scripting 1 12-03-2007 06:32 PM
export env variables varun.81 Shell Programming and Scripting 2 04-30-2007 08:39 AM
export variables srishan Shell Programming and Scripting 4 07-06-2004 01:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-29-2008
smartgupta smartgupta is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 109
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 06:05 AM..
  #2 (permalink)  
Old 09-29-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,330
Run (source) your script with the environment variables in the current shell:


Code:
. ./script_with_variables

Regards
  #3 (permalink)  
Old 09-29-2008
smartgupta smartgupta is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 109
I am not able to execute the script by
. filename.ksh
or . ./filename.ksh

I am able to run any script using
ksh filename.ksh
  #4 (permalink)  
Old 09-29-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,330
Quote:
Originally Posted by smartgupta View Post
I am not able to execute the script by
. filename.ksh
or . ./filename.ksh

I am able to run any script using
ksh filename.ksh
Why not? It should not be a problem if you make the file executable (chmod).
With "ksh filename.ksh" you're starting the script in a new shell (child) and all variables you've set are lost if the script exits. The parent shell don't inherit anything from the child.

Regards
  #5 (permalink)  
Old 09-29-2008
smartgupta smartgupta is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 109
yes,I made the file executable (chmod).but afterthat I am not able to execute it.when I am executing it by

#ls -l
-rwxrwxrwx 1 root other 5338 Sep 29 13:16 profile.ksh


# ./profile.ksh
./profile.ksh: bad substitution

# . ./profile.ksh
bad substitution
  #6 (permalink)  
Old 09-29-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,330
Post the contents of profile.ksh.

Regards
  #7 (permalink)  
Old 09-29-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
make sure there's no ^M characters in a script file: cat -vet profile.ksh

if there're control chars, "man dos2unix"
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0