Error : no closing quote in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Error : no closing quote in unix
# 1  
Old 07-30-2007
Power Error : no closing quote in unix

Hey
I was stuck in middle of writing this script Can any one help me out of this

I am writing this script to delete the log files certain days old
and everything fine but when I run the script I always see error at the bottom

./PurgeOneParameter.ksh[254]: no closing quote

and for the last if (WTDATA) clause though the log file is there in the given directory it's not deleting

I am unable to figure out why this is happening
Can Any body help

Script is as follows


#!/bin/ksh
pid=$$
rundate=`date '+%Y%m%d'`
MinOrderlink=20
Minintegration=10
Minwtdata=10
MinOrdZoneManaged=20
MinOrderingDomain=10
MinOrderingAdmServ=10
Minnohup=10
Minaccess=10
Minorderszone=10
Minbatchzonemanaged=10
echo "Mindata value at thte begining $Minwtdata"
MaxOrderlink=30
Maxintegration=14
Maxwtdata=30
MaxOrdZoneManaged=30
MaxOrderingDomain=14
MaxOrderingAdmServ=14
Maxnohup=14
Maxaccess=30
Maxorderszone=14
Maxbatchzonemanaged=30

b=1
isScheduler=1
echo "$isScheduler"
ORDLINK='orderlink'
INTEGRATION='integration'
ACCESS='access'
WTDATA='wtdata'
ORDZONEMANAGED='ordzonemanaged'
ORDERINGDOMAIN='orderingdomain'
ORDERINGADMSERV='orderingadmserv'
NOHUP='nohup'
ORDERSZONE='orderszone'
BATCHZONEMANAGED='batchzonemanaged'


echo "\n`df -k /web`\n"

echo "First Parameter is [$1]"
echo "This Parameter Count is [$#]"
if [[ $# -ne 1 && $# -ne 0 ]]
then
echo "Error in $0 - Invalid Argument Count"
echo "Syntax: $0 input_file output_file"
exit
fi
inputParameter=$1 ## Input parameter
indexOfEq=`expr index "$inputParameter" "="`
echo $indexOfEq
index2=`expr $indexOfEq - $b`
echo $index2

logName=`expr substr "$inputParameter" $b $index2`
echo "Sub: '$logName'"

logvalue=`echo $inputParameter | sed 's/^.*=//g'` ##no of days
echo $logvalue

if [[ -z "$inputParameter" ]]
then
isScheduler=1
else
isScheduler=0
fi
echo "$isScheduler"
if [ isScheduler -eq 1 ]
then
echo "true"
else
echo "false"
fi
if [[ isScheduler -eq 1 || "$logName" = "$ORDLINK" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$MaxOrderlink
else
deleteValue=$logvalue
echo "deletevalue in ordlink $deleteValue"
fi
if [ ${deleteValue} -ge ${MinOrderlink} -a ${deleteValue} -le ${MaxOrderlink} ]
then
echo "Found in between"
find /web/local/orderlink/managed*/scripts/SMOappLogs/log -name 'orderlink.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/scripts/SMOappLogs/log -name 'orderlink.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $MinOrderlink and $MaxOrderlink "
fi
fi
if [[ isScheduler -eq 1 || "$logName" = "$INTEGRATION" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxintegration
else
deleteValue=$logvalue
echo "deletevalue in integration $deleteValue"
fi
if [ ${deleteValue} -ge ${Minintegration} -a ${deleteValue} -le ${Maxintegration} ]
then
find /web/local/orderlink/managed*/scripts/SMOappLogs/log -name 'integration.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/scripts/SMOappLogs/log -name 'integration.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be between {Minintegration and $Maxintegration "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$ACCESS" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxaccess
else
deleteValue=$logvalue
echo "deletevalue in access $deleteValue"
echo "max $Maxaccess"
fi
if [ ${deleteValue} -ge ${Minaccess} -a ${deleteValue} -le ${Maxaccess} ]
then
find /web/weblogic8.1/weblogic/OrdZone*Managed* -name 'access.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/weblogic8.1/weblogic/BatchZone*Managed* -name 'access.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/weblogic8.1/weblogic/OrdZone*Managed* -name 'access.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/user_projects/domains/OrderingDomain/logs -name 'access.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/user_projects/domains/OrderingDomain/OrderingAdmServ -name 'access.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $Minaccess and $Maxaccess"
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$ORDZONEMANAGED" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$MaxOrdZoneManaged
else
deleteValue=$logvalue
fi
echo "deletevalue in ordzonemanaged $deletevalue"
if [ ${deleteValue} -ge ${MinOrdZoneManaged} -a ${deleteValue} -le ${MaxOrdZoneManaged} ]
then
find /web/local/orderlink/managed*/scripts -name 'OrdZone*Managed*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/managed*/weblogic/log -name 'OrdZone*Managed*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $MinOrdZoneManaged and $MaxOrdZoneManaged "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$ORDERINGDOMAIN" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$MaxOrderingDomain
else
deleteValue=$logvalue
fi
echo "deletevalue in ORDERINGDOMAIN $deleteValue"
if [ ${deleteValue} -ge ${MinOrderingDomain} -a ${deleteValue} -le ${MaxOrderingDomain} ]
then
find /web/local/orderlink/user_projects/domains/OrderingDomain/ -name 'OrderingDomain.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $MinOrderingDomain and $MaxOrderingDomain "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$ORDERINGADMSERV" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$MaxOrderingAdmServ
else
deleteValue=$logvalue
fi
echo "deletevalue in ORDERINGADMSERV $deleteValue"
if [ ${deleteValue} -ge ${MinOrderingAdmServ} -a ${deleteValue} -le ${MaxOrderingAdmServ} ]
then
find /web/local/orderlink/user_projects/domains/OrderingDomain/OrderingAdmServ -name 'OrderingAdmServ.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $MinOrderingAdmServ and $MaxOrderingAdmServ "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$NOHUP" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxnohup
else
deleteValue=$logvalue
fi
echo "deletevalue in NOHUP $deleteValue"
if [ ${deleteValue} -ge ${Minnohup} -a ${deleteValue} -le ${Maxnohup} ]
then
find /web/local/orderlink/user_projects/domains/OrderingDomain -name 'nohup*' -type f -mtime +$deleteValue -exec rm -f {} \;
nohupFile=/web/local/orderlink/user_projects/domains/OrderingDomain/nohup.out
cp ${nohupFile} ${nohupFile}.${rundate}.${pid}
> ${nohupFile}
compress ${nohupFile}.${rundate}.${pid}
else
echo "No of days entered should be betwwen $Minnohup and $Maxnohup "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$ORDERSZONE" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxorderszone
else
deleteValue=$logvalue
fi
echo "deletevalue in ORDERSZONE $deleteValue"
if [ ${deleteValue} -ge ${Minorderszone} -a ${deleteValue} -le ${Maxorderszone} ]
then
find /web/local/orderlink/user_projects/domains/OrderingDomain/OrdersZone* -name 'OrdersZone*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $Minorderszone and $Maxorderszone "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$BATCHZONEMANAGED" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxbatchzonemanaged
else
deleteValue=$logvalue
fi
echo "deletevalue in BATCHZONEMANAGED $deleteValue"
if [ ${deleteValue} -ge ${Minbatchzonemanaged} -a ${deleteValue} -le ${Maxbatchzonemanaged} ]
then
find /web/local/orderlink/batchmanaged*/scripts -name 'BatchZone*Managed*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/weblogic/log -name 'BatchZone*Managed*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $Minbatchzonemanaged and $Maxbatchzonemanaged"
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$WTDATA" ]]
then
echo " Start wtdasta "
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxwtdata
else
deleteValue=$logvalue
echo "deletevalue in wtdata $deleteValue
fi
echo "max $Maxwtdata"
echo "Min $Minwtdata"
echo "deletevalue $deleteValue"
if [ ${deleteValue} -ge ${Minwtdata} -a ${deleteValue} -le ${Maxwtdata} ]
then
echo "In between limit"
find /web/local/orderlink/managed*/scripts/SMOappLogs/log -name 'wtdata.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/scripts/SMOappLogs/log -name 'wtdata.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $Minwtdata and $Maxwtdata "
fi
fi

echo "\n`df -k /web`\n"

the if loop which is not working is highlighted

thanks in advance
pinky
# 2  
Old 07-30-2007
I am trying to delete the log files by giving thae following command from the command prompt

./PurgeOneParameter.ksh wtdata=4

to delete the log file wtdata.log.*
# 3  
Old 07-30-2007
This line is missing a close quote.

echo "deletevalue in wtdata $deleteValue
# 4  
Old 07-30-2007
I just simplified the script and question is same but I felt it's huge script

So modified it to three if statement

I deseparately needed help
Thanks in Advance


#!/bin/ksh
pid=$$
rundate=`date '+%Y%m%d'`

MinOrderlink=20
Minwtdata=10
Minbatchzonemanaged=10

MaxOrderlink=30
Maxwtdata=30
Maxbatchzonemanaged=30

b=1
isScheduler=1

ORDLINK='orderlink'
WTDATA='wtdata'
BATCHZONEMANAGED='batchzonemanaged'

echo "\n`df -k /web`\n"

echo "First Parameter is [$1]"
echo "This Parameter Count is [$#]"
if [[ $# -ne 1 && $# -ne 0 ]]
then
echo "Error in $0 - Invalid Argument Count"
echo "Syntax: $0 input_file output_file"
exit
fi
inputParameter=$1 ## Input parameter
indexOfEq=`expr index "$inputParameter" "="`
echo $indexOfEq
index2=`expr $indexOfEq - $b`
echo $index2

logName=`expr substr "$inputParameter" $b $index2`
echo "Sub: '$logName'"

logvalue=`echo $inputParameter | sed 's/^.*=//g'` ##no of days
echo $logvalue

if [[ -z "$inputParameter" ]]
then
isScheduler=1
else
isScheduler=0
fi
echo "$isScheduler"
if [ isScheduler -eq 1 ]
then
echo "true"
else
echo "false"
fi
if [[ isScheduler -eq 1 || "$logName" = "$ORDLINK" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$MaxOrderlink
else
deleteValue=$logvalue
echo "deletevalue in ordlink $deleteValue"
fi
if [ ${deleteValue} -ge ${MinOrderlink} -a ${deleteValue} -le ${MaxOrderlink} ]
then
echo "Found in between"
find /web/local/orderlink/managed*/scripts/SMOappLogs/log -name 'orderlink.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/scripts/SMOappLogs/log -name 'orderlink.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $MinOrderlink and $MaxOrderlink "
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$BATCHZONEMANAGED" ]]
then
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxbatchzonemanaged
else
deleteValue=$logvalue
fi
echo "deletevalue in BATCHZONEMANAGED $deleteValue"
if [ ${deleteValue} -ge ${Minbatchzonemanaged} -a ${deleteValue} -le ${Maxbatchzonemanaged} ]
then
find /web/local/orderlink/batchmanaged*/scripts -name 'BatchZone*Managed*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/weblogic/log -name 'BatchZone*Managed*.log*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $Minbatchzonemanaged and $Maxbatchzonemanaged"
fi
fi
if [[ $isScheduler -eq 1 || "$logName" = "$WTDATA" ]]
then
echo " Start wtdasta "
if [ isScheduler -eq 1 ]
then
deleteValue=$Maxwtdata
else
deleteValue=$logvalue
echo "deletevalue in wtdata $deleteValue
fi
echo "max $Maxwtdata"
echo "Min $Minwtdata"
echo "deletevalue $deleteValue"
if [ ${deleteValue} -ge ${Minwtdata} -a ${deleteValue} -le ${Maxwtdata} ]
then
echo "In between limit"
find /web/local/orderlink/managed*/scripts/SMOappLogs/log -name 'wtdata.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
find /web/local/orderlink/batchmanaged*/scripts/SMOappLogs/log -name 'wtdata.log.*' -type f -mtime +$deleteValue -exec rm -f {} \;
else
echo "No of days entered should be betwwen $Minwtdata and $Maxwtdata "
fi
fi
echo "\n`df -k /web`\n"
# 5  
Old 07-30-2007
Thanks a lot awk
It worked u made my life easy thanks again
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing all but the first and last double quote in a line with a single quote with awk

From: 1,2,3,4,5,This is a test 6,7,8,9,0,"This, is a test" 1,9,2,8,3,"This is a ""test""" 4,7,3,1,8,"""" To: 1,2,3,4,5,This is a test 6,7,8,9,0,"This; is a test" 1,9,2,8,3,"This is a ''test''" 4,7,3,1,8,"''"Is there an easy syntax I'm overlooking? There will always be an odd number... (5 Replies)
Discussion started by: Michael Stora
5 Replies

2. Shell Programming and Scripting

Replacing Double Quote in Double Quote incsv file

Hi All , We have source data file as csv file and since data could contain commas ,each attribute is quoted into double quotes.However problem is that some of the attributa data also contain double quotes which is converted to double double quote while creating csv file XLs data : ... (2 Replies)
Discussion started by: Shalini Badal
2 Replies

3. Shell Programming and Scripting

Bash error when using quote

Hello. Someone can it tell me why the following syntax is incorrect. And so how to treat the filenames with spaces. linux:~ # ls "/usr/NX/var/log/*.log" ls: cannot access /usr/NX/var/log/*.log: No such file or directory linux:~ # But this one is correct. linux:~ # ls... (7 Replies)
Discussion started by: jcdole
7 Replies

4. Programming

Quote character Unix to Oracle

Hi, I'm trying to load data into an Oracle DB. A Perl script opens a file that was created with vi on Unix, connects to the DB and inserts data. All characters (some of which are special characters) in my data can be loaded except for one: ' It turns into something else in the DB. The... (3 Replies)
Discussion started by: TheG
3 Replies

5. Shell Programming and Scripting

replacing a quote in some lines with multiple quote fields

i want to replace mistaken quotes in line starting with tag 300 and relocate the quote in the correct position so the input is 223;25 224;20100428064823;1;0;0;0;0;0;0;0;8;1;3;9697;18744;;;;;;;;;;;; 300;X;Event:... (3 Replies)
Discussion started by: wradwan
3 Replies

6. Shell Programming and Scripting

Regex in grep to match all lines ending with a double quote (") OR a single quote (')

Hi, I've been trying to write a regex to use in egrep (in a shell script) that'll fetch the names of all the files that match a particular pattern. I expect to match the following line in a file: Name = "abc" The regex I'm using to match the same is: egrep -l '(^) *= *" ** *"$' /PATH_TO_SEARCH... (6 Replies)
Discussion started by: NanJ
6 Replies

7. Shell Programming and Scripting

closing a telnet session on error, in a shell script

I am using a shell script to telnet into a remote unix server and execute certain commands. But if any command being executed remotely, throws an error, the script just hangs. And the telnet session does not get closed. I want to be able to close the session and complete the script execution in... (1 Reply)
Discussion started by: farahzaiba
1 Replies

8. Shell Programming and Scripting

double-quote inside double-quote

hey all, i made a simple .sh like this: echo "<style media="screen" type="text/css">@import url("main.css");</style>" but the output is: <style media=screen type=text/css>@import url(main.css);</style> i want to keep double-quotes, can anyone help me? thanks (3 Replies)
Discussion started by: indraf
3 Replies

9. Shell Programming and Scripting

Capturing Data between first quote and next quote

I have input file like RDBMS FALIURE UTY8703 'USER_WORK.TEST' .HIghest return code '12' I want to parse data which comed between first quote till next quote USER_WORK.TEST can you please suggest how to do that (4 Replies)
Discussion started by: scorp_rahul23
4 Replies

10. Programming

Error closing read file

Every time I close a file that I opened for reading I get the following error: ”Memory fault(coredump)”. And, although it does not (I think) affect the overall process (I write another file based on the file I am reading); it is something I would rather not happen. I don't know why this is... (1 Reply)
Discussion started by: ALTRUNVRSOFLN
1 Replies
Login or Register to Ask a Question