Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Error : no closing quote in unix Post 302129358 by pinky on Monday 30th of July 2007 02:35:35 PM
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"
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
All times are GMT -4. The time now is 04:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy