Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Bash & Ksh

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 08-24-2009   -   Original Discussion by talashil
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   -   Original Discussion by talashil
Smiling Dragon's Unix or Linux Image
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
Join Date: Nov 2007
Last Activity: 27 July 2017, 4:23 PM EDT
Location: New Zealand
Posts: 1,060
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

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 02: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 04:17 AM
bash and ksh: variable lost in loop in bash? estienne Shell Programming and Scripting 2 08-25-2008 03:09 PM
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 01:25 PM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 08:19 AM

All times are GMT -4. The time now is 12:06 AM.