Passing environment variables to parent shells


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Passing environment variables to parent shells
# 1  
Old 08-04-2007
Passing environment variables to parent shells

Hi,

I am using bash and need to run a set of tcsh scripts that set environment variables. Is there a way to do this? Any help greatly appreciated.
# 2  
Old 08-04-2007
Can you explain your requirement in detail please ????
kamitsin
# 3  
Old 08-04-2007
Thanks for the response.

I use Bash, but others have written a lot of scripts in tcsh. These tcsh set a lot of different environment variables that are used to set paths, tool licenses, etc....

So, for example, if i'm in Bash, I want to run a script called 'test.csh' that contains the single line:

setenv PROJ_HOME /proj/myproj

How do I get $PROJ_HOME to be seen from Bash?
# 4  
Old 08-04-2007
Got it

If I am in Bash, I have a C-shell script I want to run that sets an environment variable that I want, I can do this:

The file 'cshwrap' contains the line:
exec /bin/csh -c "source $1; exec /bin/bash"

Then I can just do:
. cshwrap cshfilename
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing key column from parent to child records

Hi Forum. I have this challenging issue that I'm hoping someone can help me. I have a file that contains 3 different types of segments (AM00, AM01, AM32) in a hierarchy structure and I want to be able to pass the column key from the parent record to the children records. AM00 - parent key:... (13 Replies)
Discussion started by: pchang
13 Replies

2. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

3. IP Networking

Message passing from child to parent using pipes

Hi, I am trying my hand in networking programming in C, and got stuck in piping. I was following some tutorial and did the forking like : while (1) { newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen); if (newsockfd < 0) ... (4 Replies)
Discussion started by: abhi1988sri
4 Replies

4. Shell Programming and Scripting

Oracle environmental variables in shells script

Hi, Getting below error on executing the shell script which initiates sqlplus How to set oracle enviornment variables in the shell script ? With Regards (3 Replies)
Discussion started by: milink
3 Replies

5. UNIX for Advanced & Expert Users

how to make a parent wait on a child shells running in background?

Hi I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running. My Code: ... (1 Reply)
Discussion started by: albertashish
1 Replies

6. Shell Programming and Scripting

Passing a variable from a child script back to the parent

Hi I have written a script using ftp to get files from one server and copy them to 2 dirrerent servers. I wish to call this script from a parent script that will check the number of files copied and run a check sum for each file. As the filenames for the files in the get portion of the script... (3 Replies)
Discussion started by: Andy82
3 Replies

7. Shell Programming and Scripting

Killing parent shells from subshells (KSH)

Hi all, I have a shell script which calls other shell scripts, depending on the input. Within a.sh, I have a command which calls b.sh (ie. ksh b.sh) Normally, we use the exit function to terminate a shell. However, if I choose to call exit from b.sh, I will return to the parent shell who... (4 Replies)
Discussion started by: rockysfr
4 Replies

8. Shell Programming and Scripting

Environment Variable Parent PID

I have always used the "$$" environment variable to find the current process number. Is there any similar way or perhaps something else to easily find the parent process number? I realize I could do something like ps and grep for the process and cut or awk out the parent process but I wanted to... (1 Reply)
Discussion started by: scotbuff
1 Replies

9. Shell Programming and Scripting

How to pass CSH variables up to the parent?

Hi .. I have a dynamic script called from a programming language called Powerhouse (4GL). The module, called QUIZ, allows the user to call shell commands from within it... i.e. !rm -f mipss156t2cmd1.bat mipss156t2tmp1.txt !printf '#!/bin/csh\n' > mipss156t2cmd1.bat !printf 'setenv... (0 Replies)
Discussion started by: ElCaito
0 Replies

10. Shell Programming and Scripting

Validating variables in shells script

All Can you help me to validate a variable only for string and digit. That is variable should either fully alphabets or digits. Please send me result to my mail id also: REMOVED Thanx in advance Regards Deepak Xavier (1 Reply)
Discussion started by: DeepakXavier
1 Replies
Login or Register to Ask a Question