tchsh or csh?

Hello,

I might have a problem with tcsh because I receive this message:

setenv: too many arguments

when running the script below,

#!/bin/csh -f

set rundir="$cwd"
set fullscrname="$0"
set fullscrname=ls -l $fullscrname | awk '{print $NF}'
set scrname="$fullscrname:t"
set fullscrpath=$fullscrname:h
if ($fullscrpath == $fullscrname) then
set fullscrpath=$cwd
else
cd $fullscrpath
set fullscrpath=$cwd
endif
cd $rundir
set prodir="$fullscrpath:h"
set mc=$prodir/install/unix/getpmt
setenv PRODIR $prodir

if ( $mc == “hpux_pa64” ) then
if ( ! -d $prodir/hpux_pa64/obj ) then
set mc=“hpux11_pa32”
endif
endif
if ( $mc == “hpux11_pa32” ) then
if ( ! -d $prodir/hpux11_pa32/obj ) then
set mc=“hp8k”
endif
endif
if ( $mc == “hp8k” ) then
if ( ! -d $prodir/hp8k/obj ) then
if ( -d $prodir/hp700 ) set mc=“hp700”
endif
endif
if ( $mc == “sgi_elf4” ) then
if ( ! -d $prodir/sgi_elf4/obj ) then
set mc=“sgi_mips4”
endif
endif
if ( $mc == “sgi_mips4” ) then
if ( ! -d $prodir/sgi_mips4/obj ) then
if ( -d $prodir/sgi_elf2 ) set mc=“sgi_elf2”
endif
endif
if ( $mc == “sun4_solaris_64” )then
if ( ! -d $prodir/sun4_solaris_64/obj ) then
if ( -d $prodir/sun4_solaris ) set mc=“sun4_solaris”
endif
endif

set libset="$prodir/$mc/obj/ps_libset"
if ( ! -x $libset ) unset libset

setenv MC $mc
setenv PRO_MACHINE_TYPE $mc

setenv PRO_DIRECTORY $prodir

setenv FORCE_PMT $MC
$PRO_DIRECTORY/$MC/obj/proe.exe $*
exit $status

I’m running openSUSE 11. Any suggestions? Thanks!

André Luiz

Whenever you use a variable that might expand to a string with space(s) in it you should quote the variable, otherwise it becomes two or more arguments. Thus for example:

setenv FOO "$bar"

Similarly for variable substitution in bash also. You’ll have to figure out which setenv is having the problem.

Hello,

WOW, THANKS!

André Luiz