Shell Program Error undefined Variable?

Following is the script

#!/bin/csh  

#*+P
#$Header: $
#
#
#$Log: $
#
#-P*#


#created by tom mclaughlin 01/13/00

#create_three_tables.csh--creates three tables needed in Sybase for join
#statement in Volume Definition File process

echo "Enter the Sybase database where your want"
echo "to create the tables followed by a carriage return"
read database

echo "Enter the center followed by a carriage return."
read center

echo "Enter your sybase username followed by a carriage return."
read username

echo "Enter your sybase password followed by a carriage return."
read password

##input center into sql statements
sed -f "s/CENTER/$center/g" /home/tmclaugh/test/airspace.sql >! /home/tmclaugh/test/airspace.sql.tmp            
sed -f "s/CENTER/$center/g" /home/tmclaugh/test/fpa.sql >! /home/tmclaugh/test/fpa.sql.tmp
sed -f "s/CENTER/$center/g" /home/tmclaugh/test/node_latlng.sql >! /home/tmclaugh/test/node_latlng.sql.tmp

#create tables

echo "creating airspace table"

isql -D $database -U $username -P $password < /home/tmclaugh/test/airspace.sql.tmp

echo "done creating airspace table"

#create fpa table

echo "creating fpa table"

isql -D $database -U $username -P $password < /home/tmclaugh/test/fpa.sql.tmp

echo "done creating fpa table"

#create node_latlng table

echo "creating node_latlng table"

      isql -D $database -U $username -P $password < /home/tmclaugh/test/node_latlng.sql.tmp

echo "done creating node_latlong table"


echo "all three tables should be in the database you selected in Sybase"


The error I keep getting says that center is an undefined variable?


tomatocansAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

expert99121199Commented:
change

#!/bin/csh

to

#!/bin/sh


Also remove the "!" character from the output redirects.

For example,

sed -f "s/CENTER/$center/g" /home/tmclaugh/test/fpa.sql >! /home/tmclaugh/test/fpa.sql.tmp

should be

sed -f "s/CENTER/$center/g" /home/tmclaugh/test/fpa.sql > /home/tmclaugh/test/fpa.sql.tmp

"read variable" is not  C shell syntax.

it looks like a Bourne/Korn script, not a C shell  script.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomatocansAuthor Commented:
Thank you very much.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.