The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Environmental Variable janemary.a Shell Programming and Scripting 2 05-15-2007 01:46 AM
Setting variable briskbaby Shell Programming and Scripting 1 09-14-2006 04:10 PM
Set Oracle Environmental Variable !! uuser Shell Programming and Scripting 4 02-22-2006 02:46 PM
setting PS1 variable papachi UNIX for Dummies Questions & Answers 4 05-23-2005 03:08 PM
Setting a variable photh UNIX for Dummies Questions & Answers 2 01-08-2003 10:03 AM

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 03-20-2009
mefquik mefquik is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 2
Question setting ksh environmental variable

Hi,

I have problem setting up environmental variables.
The idea is to start with main.ksh script that will run setting.ksh, and in side of it I'll set up variables.

Please take a look at my code, and help me to find my mistake.

Thanks,
Mila

Main.ksh look like this:
Code:
#!/usr/bin/ksh
# next line will run settings.ksh from the same directory
./settings.ksh
# next few lines will print some variables
print "\nPRINT FROM MAIN: "
print "username : $myUSER"
print "project  : $myPROJECT"
print "crontab  : $myCRONTAB"
Settings.ksh looks like this:
Code:
#!/usr/bin/ksh
# next line will set username
export myUSER=mim
# next 2 lines will set variables with path to every file or folder
export myPROJECT="$HOME/project"
export myCRONTAB="$PROJECT/crontab"

print "\nPRINT FROM SETTINGS: "
print "username : $myUSER"
print "project  : $myPROJECT"
print "crontab  : $myCRONTAB"
And the result i get in terminal is:
Code:
PRINT FROM SETTINGS: 
username : mim
project  : /home/mim/project
crontab  : /crontab

PRINT FROM MAIN: 
username : 
project  : 
crontab  :
  #2 (permalink)  
Old 03-21-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,300
Run the script settings.ksh in the current shell of main.ksh with:

Code:
. ./settings.ksh
Regards
  #3 (permalink)  
Old 03-21-2009
mefquik mefquik is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 2
Thanks!!!!!
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 03:53 AM.


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