How to access the bash variables in csh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to access the bash variables in csh
# 1  
Old 06-06-2012
How to access the bash variables in csh

Hi,

I am having a primary script which is Bash based. I am calling a csh script from it.

Now, their are some variables defined in my bash script which i need in csh.
I am unable to do so. Is it possible ?
# 2  
Old 06-06-2012
export the variables
This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 06-06-2012
Hi


Code:
$ cat test.sh
#!/bin/bash

export VAR="welcome"

echo "In Bash: $VAR"

#calling a csh script
test2.sh

Code:
$ cat test2.sh
#!/bin/csh

echo "In csh: $VAR"

On running the script:
Code:
$ ./test.sh
In Bash: welcome
In csh: welcome

Guru.
This User Gave Thanks to guruprasadpr For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue nesting variables in csh.

The variables given are already defined ($file1-$file3, $obsid1-$obsid3, and $n=3). When I go to run the code, the terminal outputs "Missing }." I believe the error is with the nesting of variables. It would save a lot of time getting this while loop working. set i = 1 while (${i} <=... (5 Replies)
Discussion started by: ojdefdidit
5 Replies

2. Shell Programming and Scripting

Read variables from a text file for use in csh script

Hello, I have a text file (say, declarevars.txt) that contains multiple lines that are essentially meant to be variable declarations: set arr1 = (var1a var1b var1c) set arr2 = (var2a var2b var2c) . . . I want to be able to read this text file within a csh (sorry) script and have that... (2 Replies)
Discussion started by: arjaydj
2 Replies

3. 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

4. Shell Programming and Scripting

How to use ifdef for bash variables in csh environment?

Hi Guys, I have a a bash script and i am exporting a variable in it. I am calling a csh script from this bash script. The variable "ABC" will be visible in csh script. ks.bash export ABC = abc ./kp.csh ab.csh echo $ABC setenv ABC =cde (i want to assign this value to ABC only if... (4 Replies)
Discussion started by: vdhingra123
4 Replies

5. Shell Programming and Scripting

Max number of environment variables in Csh

Anyone knows what is the max limit of number of environment variables in Csh? I have a script that when run causes the shell to stop responding to any command like: ls /bin/ls: Argument list too long. And I guess the reason is I passed the max limit for number of environment variables... (1 Reply)
Discussion started by: mohy
1 Replies

6. Shell Programming and Scripting

Csh Problem using spaces in string variables

I have done something like this set phases = "a b" set phases = "phases="$phases echo $phases I get phases=a instead of phases=a b (3 Replies)
Discussion started by: kristinu
3 Replies

7. Shell Programming and Scripting

Bash one liner to CSH

Hello all, I have a Bash command I'm using on one system that replaces text in filenames, I'ts not working on another system that uses the Csh shell. Can anyone tell me what I need to do when i run for f in *;do mv $f ${f/text1/text2};done on the CSH shell i get ""Missing }."" (7 Replies)
Discussion started by: mike171562
7 Replies

8. UNIX for Dummies Questions & Answers

For loop control with two variables in csh shell

Hi All How can i control for loop with two different variables in csh shell Regards Nikhil (1 Reply)
Discussion started by: Nikhilindurkar
1 Replies

9. Shell Programming and Scripting

how to make your bash script run on a machine with csh and bash

hi, i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Discussion started by: npatwardhan
3 Replies

10. 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
Login or Register to Ask a Question