It is currently Tue, 17 May 2022 02:25:39 GMT



 
Author Message
 exporting C shell variable

Hello all
        To keep a story short, is it possible to export C shell
variables (eg env) to bourne shell to read.  Would a simple command
like this work...

#!/bin/sh
...something in bourne
/bin/csh cscript                #including variables (eg a = 1, b = 2)
...reads $a and $b

+... would the /bin/csh supposedly read the .login or .cshrc files?
Thanks for any help on this
        Terrance



 Tue, 04 Apr 2000 03:00:00 GMT   
 exporting C shell variable

On Fri, 17 Oct 1997 22:02:43 GMT, Terrance
: #!/bin/sh
: ...something in bourne
: /bin/csh cscript              #including variables (eg a = 1, b = 2)
: ...reads $a and $b

The child process inherits the envirnoment of its parrent;
NOT the other way around, so the answer is no.

However if you want to export env from csh, you set the env var
with setenv:
  setenv  <variablename> <value>
(RTFM)
and the env will be inherited by any sh started from your csh session.

: +... would the /bin/csh supposedly read the .login or .cshrc files?

only .cshrc. RTFM

Possibly, you might want to try this (I haven't :-):
  eval `( cat cscript; echo env ) | /bin/csh`
and then export the env var's you need using sh export,
or export automatically using a temp file and awk...

--
:-- Hans Georg           --- student of 'Life, the Universe and Everything'
<ge...@ii.uib.no>  (stud.oecon. stud.scient.)  http://www.ii.uib.no/~georg/



 Mon, 10 Apr 2000 03:00:00 GMT   
 exporting C shell variable

: On Fri, 17 Oct 1997 22:02:43 GMT, Terrance
:   <tchi...@postbox.usyd.edu.au.NOSPAM> wrote:
: : #!/bin/sh
: : ...something in bourne
: : /bin/csh cscript            #including variables (eg a = 1, b = 2)
: : ...reads $a and $b

The previous responder snipped the original question in full, so
I can guess that the solution (or at least a clarification of the
problem) lies in downloading:

ftp.uu.net/usenet/comp.sources.unix/volume13/korner.Z

--
james martin
jrmar...@blueneptune.com



 Sat, 15 Apr 2000 03:00:00 GMT   
 
   [ 3 post ] 

Similar Threads

1. export variables to calling shell in a shell-script

2. export variables to calling shell in a shell-script

3. Exporting Enviroment Variables in shell scripts

4. make - exporting shell variable to environment

5. how do I export a shell variable

6. Adding/Changing an exported Shell Variable

7. problem with exporting a shell variable from a C Program

8. Export with variable variable-names?

9. file contents into variable, or global variable from shell script

10. Creating shell variable containing substring of another variable.


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software