Unix/Linux Go Back    

Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Bash & Ksh

Shell Programming and Scripting

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 08-24-2009
talashil talashil is offline
Registered User
Join Date: Apr 2008
Last Activity: 1 September 2015, 4:10 PM EDT
Posts: 144
Thanks: 5
Thanked 0 Times in 0 Posts
Bash & Ksh

I am using a Linux machine and it's default shell is BASH . I have korn shell script and inside it's setting environment variables. But after execuitng the script those env values are not holding the values . If I run the script outside of that ksh script with source a.sh , it's able to hold to values .

what I am trying to do is ...inside the ksh

I tried to like this ..

source a.sh

and if I run it in debug mode , it's still showing it's executing it as
. a.sh ( default korn shell behaviour) .

any ideas how to do this ?

Sponsored Links
Old Unix and Linux 08-24-2009
Smiling Dragon's Unix or Linux Image
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
Join Date: Nov 2007
Last Activity: 2 September 2015, 3:14 PM EDT
Location: New Zealand
Posts: 1,059
Thanks: 25
Thanked 29 Times in 28 Posts
A script isn't going to modify the environment of the parent process - that would make no sense... Is that what you are trying to do?

If so, you need to call it without forking (ie via the . a.sh like you have above).
You can certainly do this inside a script without problems - it's a very common way of putting configuration items used by several scripts in a central file.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash preferred or ksh with bash features mrwatkin UNIX for Dummies Questions & Answers 2 06-17-2009 01:19 PM
how to make your bash script run on a machine with csh and bash npatwardhan Shell Programming and Scripting 3 11-19-2008 03:17 AM
bash and ksh: variable lost in loop in bash? estienne Shell Programming and Scripting 2 08-25-2008 02:09 PM
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 12:25 PM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 07:19 AM

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