Operating System - HP-UX
1831372 Members
3508 Online
110024 Solutions
New Discussion

what was this script telling me

 
SOLVED
Go to solution
Marc Ahrendt
Super Advisor

what was this script telling me

below is the output i had received when running ./IDT_Archive_Dailies.ksh

./IDT_Archive_Dailies.ksh[32]: syntax error at line 58 : `(' unexpected

what does the "[32]" mean? please note that i have already fixed the problem with the script (was actually an error at line 38 and not line 58), so my question is just what the script was telling me using "[32]" in the above output. seems 32 has nothing to do with a line number in the script...

hola
4 REPLIES 4
Dave Olker
Neighborhood Moderator
Solution

Re: what was this script telling me

Hi Marc,

I'm not really sure what the [32] means but a quick Google search turned up a hit in the O'Reilly KSH book:

scriptname[N]: lskdjfafd: not found
ERROR: command exited with status 1.

N is the number of the line in the script that contains the bad command.

-------------------------------------

So apparently the shell thought line 32 was the problem, even though it later reported line 58 and the problem turned out to be on line 38.

Go figure...

Dave


I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Bill Hassell
Honored Contributor

Re: what was this script telling me

And just a note about the 'wrong' line number being reported. When you have an error concerning quotes or parenthesis, the line number refers to the point at which the interpreter (the shell) discovers a syntax error. The shell can't tell if you meant to add a closing quote mark on line 73 and continues to process each line until another quote is found, perhaps line 94. Everything between the open and close quotes is valid and an error is detected when the next token following the quote is not meaningful. So you take the line number reported and work backwards.


Bill Hassell, sysadmin
Peter Godron
Honored Contributor

Re: what was this script telling me

Marc,
reading man ksh:
" If the line number on which the error occurred is greater
than one, the line number is also printed in brackets ([]) after the
command or function name."
Marc Ahrendt
Super Advisor

Re: what was this script telling me

dave: that is also my conclusion "go figure..."

bill: over the years i discovered what you just detailed. i was hoping that process could be sped up if "[32]" really meant something ...seems one just is lucky if it really does point to a problematic line as with " error at line 58 "

peter: i looked at the man page and found nothing ...seems my reading skills are low (understanding better why my my kids ask my wife to read to them and not me)

bottom line seems to be that maybe using both numbers as limits (start at line 32 and stop at line 58) for searching for that script problem i had ...which did end up within those limits by being on line 38
hola