syntax error unexpected end of file in shell

Sun microsystems Solzi-080b99ym sw solar...
December 20, 2010 at 22:30:00
Specs: Windows XP
Hi,

I couldn't find whats wrong in the below code. Im getting Unexpected end of line error.


line 180: syntax error: unexpected end of file

Please help me.

while :
do
clear
echo " M A I N - M E N U"
echo "1. Database and Application Details"
echo "2. Database and Application Tuning"
echo "3. Concurrent and locks details"
echo "4. Exit"
echo -n "Please enter option [1 - 4]"
read opt
case $opt in
1) echo "************ Database and Application details *************"
while :
do
echo "1. Apache,java,Jinitiator,Forms,Perl version and collect JVM details."
echo "2. Profile Option by giving profile option name."
echo "3. Generaion of Database creation script from exisiting DB."
echo "4. Listing the roles and privileges of a particular user."
echo "5. Listing the foreign constraints in the database."
echo "6. Return back to Main Menu."
echo -n "Please enter option [1 - 6]"
read opt_1
case $opt_1 in
1) (
date
echo " "
## The script will Send script output to screen and create log file
## Collect Apache version
echo "*****Apache Version*****"
$IAS_ORACLE_HOME/Apache/Apache/bin/httpd -v
## Collect Java version
echo " "
echo "******Java Version******"
sh -c "`awk -F= '$1 ~ /^JSERVJAVA.*$/ {print $2}' $ORACLE_HOME/../iAS/Apache/Apache/bin/java.sh` -version;"
## collect JVM details
echo " "
echo "*****No of JVM & Heap size set for OACoreGroup,FormsGroup,DiscoGroup and XmlSvcs Group****"
cd $IAS_ORACLE_HOME/Apache/Jserv/etc
cat jserv.conf |grep OACoreGroup| grep jserv.properties|cut -c 1-27
cat jserv.properties|grep Xmx
echo " "
cat jserv.conf |grep FormsGroup|grep forms.properties|cut -c 1-27
cat forms.properties|grep Xmx
echo " "
cat jserv.conf |grep DiscoGroup| grep viewer4i.properties|cut -c 1-27
cat viewer4i.properties|grep Xmx
echo " "
cat jserv.conf |grep XmlSvcsGrp| grep xmlsvcs.properties|cut -c 1-27
cat viewer4i.properties|grep Xmx
echo " "
## Collect JOB value
echo "****Java Object Cache Value*****"
cat jserv.properties|grep LONG_RUNNING_JVM
echo " "
## Collect jinitiator version
echo "*****Jinitiator version*****"
cat $FORMS60_WEB_CONFIG_FILE|grep jinit_ver_name=Version|cut -c 1-32
echo " "
## Collect forms version
echo "*****Forms Version*****"
f60gen|grep Forms|grep Version
echo " "
## Collect forms communication mode
echo "****Forms Communication Mode****"
cat $FORMS60_WEB_CONFIG_FILE|grep serverURL=
echo "If the serverURL parameter has no value then Forms is implemented in socket mode else it is servlet"
echo " "
## Collect Perl version
echo "*****perl version******"
$IAS_ORACLE_HOME/Apache/perl/bin/perl -v|grep version
echo " "
## Collect Pl/Sql version
echo "****PL/SQL Version****"
f60gen|grep PL/SQL|grep Version
##
echo " "
echo "Script Completed Successfully and it has generated the file `hostname`_`date +%m%d%y.%H%M`.txt file in curren
t directory"
) 2>&1 | tee `hostname`_`date +%m%d%y.%H%M`.txt
;;

2) echo "Enter Apps login in the format apps/apps_pwd"
read pwd
echo "Enter the profile option name in the format '%PRODUCT_SHORT_NAME%'"
read profile_name
echo "Enter the user profile name in the format '%PRODUCT_SHORT_NAME%'"
read user_profile_name

sqlplus -s << EOSQL
$pwd
set long 10000
set pagesize 500
set linesize 160
column SHORT_NAME format a30
column NAME format a40
column LEVEL_SET format a15
column CONTEXT format a30
column VALUE format a40
spool profile_values_out.lst
select p.profile_option_name SHORT_NAME,
n.user_profile_option_name NAME,
decode(v.level_id,
10001, 'Site',
10002, 'Application',
10003, 'Responsibility',
10004, 'User',
10005, 'Server',
10006, 'Org',
10007, decode(to_char(v.level_value2), '-1', 'Responsibility',
decode(to_char(v.level_value), '-1', 'Server',
'Server+Resp')),
'UnDef') LEVEL_SET,
decode(to_char(v.level_id),
'10001', '',
'10002', app.application_short_name,
'10003', rsp.responsibility_key,
'10004', usr.user_name,
'10005', svr.node_name,
'10006', org.name,
'10007', decode(to_char(v.level_value2), '-1', rsp.responsibility_key,
decode(to_char(v.level_value), '-1',
(select node_name from fnd_nodes
where node_id = v.level_value2),
(select node_name from fnd_nodes
where node_id = v.level_value2)||'-'||rsp.responsibility_key)),
'UnDef') "CONTEXT",
v.profile_option_value VALUE
from fnd_profile_options p,
fnd_profile_option_values v,
fnd_profile_options_tl n,
fnd_user usr,
fnd_application app,
fnd_responsibility rsp,
fnd_nodes svr,
hr_operating_units org
where p.profile_option_id = v.profile_option_id (+)
and p.profile_option_name = n.profile_option_name
and upper(p.profile_option_name) in (
select profile_option_name from fnd_profile_options_tl
where upper(profile_option_name) like upper($profile_name)
and upper(profile_option_name) in (select profile_option_name
from fnd_profile_options_tl
where upper(user_profile_option_name) like upper($user_profile_name)))
and usr.user_id (+) = v.level_value
and rsp.application_id (+) = v.level_value_application_id
and rsp.responsibility_id (+) = v.level_value
and app.application_id (+) = v.level_value
and svr.node_id (+) = v.level_value
and org.organization_id (+) = v.level_value
order by short_name, user_profile_option_name, level_id, level_set
/

spool off
EXIT
EOSQL
retcode=$?
if [ $retcode != 0 ]
then
echo "Exception occured. May be no records or enter correct input."
fi
echo "Press any key to continue"
;;

3) echo "yet to be included";;
4) echo "yet to be included";;
5) echo "yet to be included";;
6) break ;;
esac
done
# echo "Press any key to continue" ;;

2) echo "2. Database and Application Tuning";;
3) echo "3. Concurrent and locks details";;
4) echo "Bye"
exit 1;;
*) echo "$opt is an invaild option. Please select option between 1-4 only"
echo "Press [enter] key to continue. . ."
read enterKey;;
esac
done

Regards,
Sathya


See More: syntax error unexpected end of file in shell

Report •

#1
December 21, 2010 at 01:42:49
Hi,

I myself found the error.

The error is in the sqlplus connection.

sqlplus -s <<-EOSQL ( I didnt used the -)
.
.
.
EOSQL ( I used space bar for indent which creates the error. Instead I should use tab before EOSQL

Regards,
Sathya


Report •

#2
March 10, 2011 at 16:08:10
Thanks It helped me .. to get rid of this error .. working from long time on it

Report •
Related Solutions


Ask Question