LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-28-2009, 05:58 AM   #1
rosariop
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Rep: Reputation: 0
typeset arithmetic syntax error


Hi all,
I'm an oracle dba and trying to build some logrotation with scripts..
So I have one script reading from another file the list of files which on doing the rotation but I have this error when I schedule the job from Oracle enterprise manager.. anyone had something similar?

logrotate.weekly START 2009-09-28 09:43
/home/oracle/logrotation/logrotate.weekly[39]: typeset: /u01/app/oracle/admin/DB01/bdump/alert_DB01.log: arithmetic syntax error
logrotate.weekly STOP 2009-09-28 09:43

logrotate.weekly is the script reading the second file with the list of files to logrotate..

Thank you in case
Rosario
 
Old 09-28-2009, 07:54 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Show us the script content
 
Old 09-29-2009, 03:20 AM   #3
rosariop
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Hi this is the main script that calls the other script logrotate.conf which is just a list of paths with logfiles like for example:

/.../.../alert.log
/.../.../listener.log

the main script is like this:

set +x
trap 'mylog "${0##*/}" " STOP ............
.
.
.
.
integer a
integer b
for a in 4 3 2 1 0; do
.
.
.
.
mylog "${0##*/}" "File \"$1.$a\" not found"
.
.
.
.
.

Last edited by rosariop; 10-13-2009 at 09:30 AM. Reason: deleted most part because script was not mine..
 
Old 09-29-2009, 10:05 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Actually, in code tags for indentation/ease of reading would have been nice. Also, indicate line 39; that's what your error msg says
Quote:
/home/oracle/logrotation/logrotate.weekly[39]: typeset: /u01/app/oracle
/admin/DB01/bdump/alert_DB01.log: arithmetic syntax error
You could change the top line to

set -xv

but I think(?) line 39 is

Quote:
mylog "${0##*/}" "File \"$1.$a\" not found"
where 'a' has prev been declared as integer type. That filename does not end in an integer.
 
Old 09-30-2009, 03:47 AM   #5
rosariop
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you very much Chris
ok I will try then not to declare any variable and to use it directly and I will see what happen..

Indeed there was also at the top of the script 16 rows of comment but I don't think 'vi' will consider these also..

About indentation sorry, original script was with it but when I copied on the forum, it has lost it automatically.

Will let you know if works

Cheers
Rosario
 
Old 10-12-2009, 08:27 AM   #6
rosariop
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you again Chris

I verified and if you don't declare the variable as integer and just use it as you need it, the error don't appear any more.

Cheers
Rosario
 
Old 10-12-2009, 07:42 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Exactly; typeset is there to catch that kind of error ie you should know what type of values can appear in a var; think C.
 
Old 10-13-2009, 09:27 AM   #8
rosariop
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Right

Now I'm gonna delete the script leaving only the part concerning the error, because the script was not mine and didn't ask permit to publish..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[python] syntax Error : invalid syntax Python_user Programming 2 09-06-2009 01:52 PM
why am getting error ksh: syntax error: `fi' unexpected while running script deb4you Linux - Newbie 4 09-06-2008 09:37 AM
swaret error "invalid arithmetic operator" Blackmeth Slackware 5 04-25-2007 12:14 PM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 07:09 PM
ERROR running make when installing Nvidia drivers (syntax error) randyriver10 Linux - Software 5 02-21-2004 05:51 PM


All times are GMT -5. The time now is 10:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration