It is currently Thu, 20 Jan 2022 04:39:22 GMT

Author Message
I have a large Bourne Shell script that need to pick up the values
of some variables set in a C-Shell script. The values are set
with setenv and I'd like to "soucre" the file that sets all the
values right before running a binary.  In doing this I came upon
what looks like a bug in either sh or csh.  The following script
demonstrates the problem.  Is it a bug or am I mis-understanding

<<<<<<<<<<< CUT HERE CUT HERE CUT HERE >>>>>>>>>>>>>>>>>>>>>

export VAR

echo Running Bourne Shell: VAR is $VAR

csh -f << exit
        setenv VAR CSHELL
        printenv VAR                      # This will print "CSHELL"
        echo Running C-Shell: VAR is $VAR # But this prints "BOURNESHELL" ?!
<<<<<<<<<<< CUT HERE CUT HERE CUT HERE >>>>>>>>>>>>>>>>>>>>>

Any help would be much appreciated.


Gareth Gaston
C. Gareth Gaston
University of Chicago

 Tue, 28 Mar 1995 20:12:07 GMT   

Unless the word delimiting the here document is quoted, the Bourne
shell performs variable expansion and command substitution on each
line before sending it to the program (csh in this case).  sh is
expanding $VAR to `BOURNESHELL' before csh even sees the line.  The
output of printenv shows that csh has its own value for the variable.

``The use of history as therapy means the corruption of history as history.''
        -- Arthur Schlesinger

Chet Ramey, Case Western Reserve University     Internet: c...@po.CWRU.Edu

 Tue, 28 Mar 1995 22:15:13 GMT   
   [ 2 post ] 

Similar Threads

1. running bourne shell script from cshell

2. Light Speed Bourne Shell! (was: Bourne shell tricks)

3. Bourne shell bugs?

4. HELP! bourne shell bug (setuid scripts)

5. Bourne shell bug?

6. Bourne shell read bug?

7. Bourne shell bugs?

8. Warning: Solaris Bourne Shell bug

9. Think I found a bug in Bourne shell!

10. a few bugs in the Bourne shell of SunOS 4.0.3c and 4.1.1

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