syntax error at line 7 param unexpected
Dear all,
In a shell script.. am having the below contents.. #!/bin/sh ORACLE_BASE=/meds/appl/oracle export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/102 export ORACLE_HOME ORACLE_SID=TABS1 PATH=/usr/ccs/bin:$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/meds/oracrs/product/102/bin export PATH DATE_SUFFIX=$(date +"%m-%d-%Y"_"%r") tmpfile=/log/dbspace/MEDS_DBSPACE$DATE_SUFFIX.log" when am trying to run this script, am getting the error syntax error at line 7: `DATE_SUFFIX=$' unexpected same DATE_SUFFIX=$(date +"%m-%d-%Y"_"%r") works fine in the command prompt..please advise what am missing ? Kai |
I tried that script:
Code:
#!/bin/sh Try something like: Code:
DATE_SUFFIX="$(date +"%m-%d-%Y"_"%r")" Code:
DATE_SUFFIX=$(date +"%m-%d-%Y"_"%R":"%S") |
I do not understand why you are getting that particular error (is the code an exact copy-and-paste?) but suggest regularising the quoting and the export commands
Code:
#!/bin/sh |
Are you sure you posted this correctly?
I only ask because tmpfile=/log/dbspace/MEDS_DBSPACE$DATE_SUFFIX.log" is obviously wrong (missing " at beginning). |
Quote:
Thanks all, that error fixed by using DATE_SUFFIX="$(date '+%m-%d-%Y_%r')" now, the current code is : #!/bin/bash ORACLE_BASE=/meds/appl/oracle export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/102 export ORACLE_HOME ORACLE_SID=meds1 PATH=/usr/ccs/bin:$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/meds/oracrs/product/102/bin export PATH DATE_SUFFIX="$(date '+%m-%d-%Y_%r')" tmpdir=/meds/work/log/dbspace tmpfile="/meds/work/log/dbspace/meds_DBSPACE$DATE_SUFFIX.log" sqlplus username/password@meds1 as sysdba <<EOF set termout off set timing on spool $tmpfile @/meds/scripts/dbspace.sql spool off exit EOF now, the spool file is not getting passed inside sqlplus and am getting the error : SQL> SQL> SQL> SP2-0332: Cannot create spool file. SQL> SQL> not spooling currently Any idea ? Kai |
Have you tried performing the block
Code:
sqlplus username/password@meds1 as sysdba <<EOF If $tmpfilie and the SQL commands are right, then it may just be an issue of mysqlplus trying to create a spool file in a folder where you do not have write permission. Try setting $tmpfile to a filename in a path that you know you have write permission on, like in your home directory. Then perform the block, and see if sqlplus shows the error. Also, a quick Google search turned up the Oracle online docs, where you can consult what error SP2-0332 really is about. http://docs.oracle.com |
All times are GMT -5. The time now is 07:29 AM. |