The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
'end of file' unexpected srisreeku Shell Programming and Scripting 1 04-28-2008 02:39 PM
end of file unexpected naveeng.81 Shell Programming and Scripting 1 03-11-2008 06:43 AM
unexpected 'end of file' + sed command kamel.seg High Level Programming 1 02-08-2008 11:00 AM
unexpected end of file dineshr85 Shell Programming and Scripting 2 10-15-2007 02:47 AM
gunzip: unexpected end of file sicjedi UNIX for Advanced & Expert Users 4 09-15-2006 10:41 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-10-2006
abhijeetkul abhijeetkul is offline
Registered User
  
 

Join Date: Oct 2005
Location: Mumbai,India
Posts: 58
Thumbs up 'end of file' unexpected

what do u mean by " 'end of file' unexpected "?

i am running a script called "s1" which internally calls "s2"
now s1 starts running & at a point (where it is suppose to call "s2")
i get a message

'end of file' unexpected....
& my script(s) are not working..

any ideas on this?

regards
abhijeet
  #2 (permalink)  
Old 04-10-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Care to show us the scripts ?
  #3 (permalink)  
Old 04-10-2006
abhijeetkul abhijeetkul is offline
Registered User
  
 

Join Date: Oct 2005
Location: Mumbai,India
Posts: 58
Thumbs up

the scenario is like this
i run "cfserver" script which calls "new_orderxml" script
& message i get is

/u02/CFS/bin/new_orderxml.sh:'end of file' unexpected...

here is "cfserver" script
-------------------------------------------------------------------

#####################################################

#CENTRAL FILE SERVER
#PROCESS :: CENTRAL FILE SERVER START SCRIPT

#####################################################

#!/usr/bin/sh
source=/u02/CFS
echo "" > $source/Log/nfs_check
echo "" > $source/Log/nfs_conf

case "$1" in
start)
str="start"
echo ""
mount > $source/Log/nfs_check
share > $source/Log/nfs_check
grep "selectica" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "clarify" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "adc" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "eoms" $source/Log/nfs_check >> $source/Log/nfs_conf
grep "ecom" $source/Log/nfs_check >> $source/Log/nfs_conf
wc -l $source/Log/nfs_conf > $source/Log/count
var=`cut -b 7-9 $source/Log/count`
echo $var
if [ $var -ge 1 ] ;
then
cfs_log="cfs_`date +%d%m%Y`.log"
ps -ef | grep 'sh cfs start' > $source/Log/pid_file
#tput setaf 4
echo "***************************************"
echo "Initialising Central File Server::"
sleep 1
echo "" >> $source/Log/cfs_log.log
echo "********************************************************************************************" >> $source/Log/$cfs_log
echo "" >> $source/Log/$cfs_log
#
echo "CENTRAL FILE SERVER STARTED ON `date`" >> $source/Log/$cfs_log
echo 0 > $source/Log/xmlcount
echo "" >> $source/Log/$cfs_log

echo "********************************************************************************************" >> $source/Log/$cfs_log
# sleep 1
#tput setaf 5
echo "STATUS :: CFS Running"
#tput setaf 4
else
#tput setaf 5
echo "MOUNT POINT ERROR"
#tput setaf 0
exit 0;
fi
echo "Initialising Order XML Transaction::"
xmlcount=0
sleep 1
#tput setaf 5
echo "STATUS :: XML Transaction Running"
#tput setaf 4
echo "Initialising ADC STATUS Transaction::"
sleep 1
#tput setaf 5
echo "STATUS :: ADC Transaction Running"
#tput setaf 4
echo "Initialising CRM STATUS Transaction::"
sleep 1
#tput setaf 5
echo "STATUS :: CRM Transaction Running"
#tput setaf 4
echo "***************************************"
# tput setaf 0
echo ""
while [ "$str" = "start" ] ;
do
sh $source/bin/new_orderxml.sh $source/bin/adc_status.sh
$source/bin/crm_status.sh
#CFS_SERVER
sleep 1
done
;;
stop)
str="stop"
echo "***************************************"
echo "Terminating Order XML Transaction::"
sleep 1
echo "Terminating ADC STATUS Transaction::"
sleep 1
echo "Terminating CRM STATUS Transaction::"
sleep 1
echo "Terminating Central File Server::"
echo "***************************************"
sleep 1
pid_proc=`cat $source/Log/pid_file | grep 'sh cfs start' | cut -b 10-14`
echo "" > $source/Log/pid_file
echo $pid_proc
sleep 1
kill $pid_proc
;;
restart)
$0 stop
sleep 1
nohup cfs start
;;
*)
echo " Usage: cfs { start | stop | restart } "
exit 1
esac
#rm $source/Log/count
-----------------------------------------------------------------------

& here is "new_orderxml" script

#! /usr/bin/ksh
# New order processing script/abhijeet/28-02-2006
# there are two 'for' loops for 'prepaid' & 'postpaid' respectively
# whats new: xmls will NOT traverse sequentially but will be copied to
# respective systems parallely.

source=/u02/CFS

echo "" > $source/Log/ox1
echo "" > $source/Log/ox2
echo "" > $source/Log/ox3
echo "" > $source/Log/ox4
echo "" > $source/Log/name1
echo "" > $source/Log/name2

ls $source/home/selectica/Outbox > $source/Log/ox1
grep "New_Ordr_" $source/Log/ox1 > $source/Log/ox2
grep "_PREPAID.xml" $source/Log/ox2 > $source/Log/ox1

# 'PREPAID' loop starts here..file to be copied only to CRM & OMS.

for file1 in `grep "New_Ordr_" $source/Log/ox1`
do
listfile="Order_PREPAID_`date+%d%m%Y`.lst"
echo $file1 >> $source/Log/$listfile
logfile="Order_PREPAID_`date+%d%m%Y`.log"
echo
"############################################################################################### ###
#################################### >> $source/Log/$logfile

echo "DATE........SYSTEM......STATUS.....FILE NAME.........TIME" >> $source/Log/$logfile

echo $file1 > $source/Log/name1
file2=`cut -b 5- $source/Log/name1`

sys1=SELECTICA
stat1=RECEIVED
echo "`date+%D`...$sys1....$stat1....$file1....`date+%T`" >> $source/Log/$logfile
sleep 2
echo "`date+%D`...IT IS A PREPAID ORDER...`date+%T`" >> $source/Log/$logfile

sys2=CLARIFY
stat2=COPIED
mstat2=RENAMED

cp $source/home/selectica/Outbox/$file1 $source/home/clarify/Inbox/$file1
echo "`date+%D`....$sys2....$stat2....$file1....`date+%T`" >> $source/Log/$logfile
mv $source/home/clarify/Inbox/$file1 $source/home/clarify/Inbox/$file2
chmod 666 $source/home/clarify/Inbox/$file2
echo "`date+%D`....$sys2....$mstat2...$file2...`date+%T`" >> $source/Log/$logfile
sleep 2

mv $source/home/clarify/Inbox/$file2 $source/home/clarify/PArchive/$file2
# file is being copied to CRM..now moving to OMS.

sys3=OMS
stat3=COPIED
mstat3=RENAMED

cp $source/home/selectica/Outbox/$file1 $source/home/oms/Inbox/$file1
echo "`date+%D`...$sys3....$stat3...$file1...`date+%T`" >> $source/Log/$logfile
mv $source/home/oms/Inbox/$file1 $source/home/oms/Inbox/$file2
chmod 666 $source/home/oms/Inbox/$file2
echo "`date+%D`...$sys3....$mstat3....$file2...`date+%T`" >> $source/Log/$logfile
sleep 2

mv $source/home/oms/Inbox/$file2 $source/home/oms/Archive/$file2
# file is being copied to OMS...'PREPAID' loop ends here.

stat0=ARCHIVED
mv $source/home/selectica/Outbox/$file1 $source/home/selectica/Archive/$file2
echo "`date+%D`...$sys1...$stat0...$file1...`date+%T`" >> $source/Log/$logfile
done


# 'POSTPAID' loop starts here

ls $source/home/selectica/Outbox > $source/Log/ox3
grep "New_Ordr_" $source/Log/ox3 > $source/Log/ox4
grep "_POSTPAID.xml" $source/Log/ox4 > $source/Log/ox3

for file3 in `grep "New_Ordr_" $source/Log/ox3`
do
listfile="Order_POSTPAID_`date+%d%m%Y`.lst"
echo $file3 >> $source/Log/$listfile
logfile="Order_POSTPAID_`date+%d%m%Y`.log"
echo "################################################################################"
echo "DATE....SYSTEM...STATUS.....FILE...........TIME " >> $source/Log/$logfile

echo $file3 > $source/Log/name2
file4=`cut -b 5- $source/Log/name2`

sys4=SELECTICA
stat4=RECEIVED

echo "`date+%D`...$sys4...$stat4...$file3...`date+%T`" >> $source/Log/$logfile
sleep 2

echo "`date+%D`....IT IS A POSTPAID ORDER.........." >> $source/Log/$logfile

sys5=ADC
stat5=RECEIVED
mstat5=RENAMED


cp $source/selectica/Outbox/$file3 $source/home/adc/Inbox/$file3
echo "`date+%D`...$sys5...$stat5...$file3....`date+%T`" >> $source/Log/$logfile

mv $source/home/adc/Inbox/$file3 $source/home/adc/Inbox/$file4
chmod 666 $source/home/adc/Inbox/$file4
echo "`date+%D`...$sys5...$mstat5...$file4...`date+%T`" >> $source/Log/$logfile

mv $source/home/adc/Inbox/$file4 $source/home/adc/PArchive/$file4
sleep 5


sys6=CLARIFY
stat6=COPIED
mstat6=RENAMED

cp $source/home/selectica/Outbox/$file3 $source/home/clarify/Inbox/$file3
echo "`date+%D`...$sys6...$stat6...$file3...`date+%T`" >> $source/Log/$logfile

mv $source/home/clarify/Inbox/$file3 $source/home/clarify/Inbox/$file4
chmod 666 $source/home/clarify/Inbox/$file4

echo "`date+%D`...$sys6...$mstat6...$file4....`date+%T`" >> $source/Log/$logfile

mv $source/home/clarify/Inbox/$file4 $source/home/clarify/PArchive/$file4
sleep 2

sys7=OMS
stat7=COPIED
mstat7=RENAMED

cp $source/home/selectica/Outbox/$file3 $source/home/oms/Inbox/$file3
echo "`date+%D`...$sys7...$stat7...$file3....`date+%T` >> $source/Log/$logfile

mv $source/home/oms/Inbox/$file3 $source/home/oms/Inbox/$file4
chmod 666 $source/home/oms/Inbox/$file4

echo "`date+%D`...$sys7...$mstat7...$file4....`date+%T` >> $source/Log/$logfile

mv $source/home/oms/Inbox/$file4 $source/home/oms/Archive/$file4

sleep 2
stat8=ARCHIVED

mv $source/home/selectica/Outbox/$file3 $source/home/selectica/Outbox/$file4
echo "`date+%D`...$sys4...$stat8....$file3....`date+%T`" >> $source/Log/$logfile
done
-------------------------------------------------------------------------




basically i m creating two 'for' loops for "PREPAID" & "POSTPAID" orders..
grepping works but it seems it is not able to enter the "for" loop"

regards
abhijeet
  #4 (permalink)  
Old 04-10-2006
kenisand kenisand is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 8
Please check u have closed all thee double quotes for eg u have not in u r xml.sh

echo
"############################################################################################### ###
#################################### >> $source/Log/$logfile

echo "DATE........SYSTEM......STATUS.....FILE NAME.........TIME" >> $source/Log/$logfile

FOr first echo statments.
  #5 (permalink)  
Old 04-10-2006
RishiPahuja's Avatar
RishiPahuja RishiPahuja is offline
Registered User
  
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Thumbs up

A way to debug the problem is run the script in debug mode using -x

eg ksh -x script

As script is a piece of interpreted code as the execution flows you will be able to located where the problem is.

Regards,
Rishi
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0