From: jmoore@ssd.kodak.com (James H. Moore 726-0322)
Newsgroups: comp.sys.sun.admin,comp.unix.questions
Subject: curious csh behavior
Date: 22 Dec 92 22:46:46 GMT
Organization: Eastman Kodak

I know that I am pushing it with csh.  I have read the cshell can be harmful
to your health, and right now I am starting to believe it.

I have hit 2 cases of unusual behavior in the past 2 weeks.  First, I wrote
a large csh script, which started exhibiting strange errors on syntactically
correct lines, until I started unsetting some variables along the way. (Is 
there a known namespace bug?).  Also, the same script will work fine, until 
I branch into some code which only gets executed optionally, I come down into
a section of csh that looks like:

#Do we still have a remaining filename or filename part
if ( $#argv == 0 ) then
        set FILENAME=$File_base
        echo "$Note_header " >! $FILENAME
else
        echo "will it continue to process"
.
.
.
endif

#Shell variable name space is tight in this script
unsetenv File_base Note_header file_pattern p2
        
echo "" >> $FILENAME


---  And what I get is:

if ( 0 == 0 ) then
set FILENAME=WH_Notes
echo WIN: ####  Warehouse Notes for  
else
Subscript out of range.

- - - - - - - - - - - - - - - - - - - -

Weird Case #2

I am  searching for a faster way of starting up my default shell (csh).
So instead of running checks for the existance of directories and incrementally
building my path, I run a cron job, and it builds my path which I source.

I source some systems variables, and other things related to default path,
and manpath in my script, which enables my cron job to look very similar
to the regular login.  (These files are sourced first by normal logins).

I get a very strange message: from the following code fragment.


##################################################################
#  Set the environment (for cron job) just like a login
##################################################################
#
#
source /usr/local/share/etc/FAST_LOGIN/variables
source /usr/local/share/etc/FAST_LOGIN/path
source /usr/local/share/etc/FAST_LOGIN/lib
source /usr/local/share/etc/FAST_LOGIN/manpath
 
set verbose
 
#Set the Architecture and OS environment versions
#Determine the Architecture and OS for Sun equipment
set arch = `/bin/arch`
setenv ARCH "$arch"
unset arch
echo $ARCH



- - - - - - - Output - - - - -
source /usr/local/share/etc/FAST_LOGIN/variables
	setenv True 1
	setenv False 0
	setenv Found 0
	setenv Defined 1
	setenv LOCAL2NET /usr/local
	setenv LOCAL2MACH /packages
.
.
.

source /usr/local/share/etc/FAST_LOGIN/path
	if ( $?DEBUG ) echo "setting mypath"
	set mypath= ( )
	set stdpath= ( /usr/ucb /bin /usr/bin )
	set localpath= ( ${LOCAL2NET}/share/scripts ${LOCAL2NET}/bin )
	set systems_path= ( /etc /usr/etc /usr/etc/yp /usr/5bin /usr/install )


source /usr/local/share/etc/FAST_LOGIN/lib
	setenv LD_LIBRARY_PATH "/usr/local/lib"

source /usr/local/share/etc/FAST_LOGIN/manpath
	setenv MANPATH "${LOCAL2NET}/share/man:/usr/share/man"
	setenv MYMANPATH ""

set arch = `/bin/arch`
setenv ARCH "$arch"
unset arch
echo $ARCH
No message !?!

Any ideas what is happening?

- - - - - - - -


Thanks in advance.  Please respond to me by email.  And yes I know that I
could write the 1st script in perl, and probably will! 

Oh, and by the way, Merry Christmas Netters!

						Sincerely,

						Jim
-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - James H. Moore, The Software Warehouse, Eastman Kodak Co. 726-0322  -
- -  jmoore@pixel.kodak.com, PROFS: EKSMTP(JMOORE)  VMS: UX047A::JMOORE -
- -  May God bless you, in Jesus' name for blessing me with your help - -
Xref: sparky comp.sys.sun.admin:9745 comp.sys.sun.hardware:6522