LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-10-2013, 12:51 PM   #1
George.evans
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Rep: Reputation: 0
Question ksh script erroring with "more tokens expected" Works on SLES 9 & 10 not 11


I have a ksh script that works fine on SLES 9.3, 10.3 but is hanging when I attempt to run it on 11.3.
When I kill the process from another session I am seeing the following in the session that was running the script which seems to be pointing me to the function call to the function AddResolution where it is saying "more tokens expected"


Here's what I am seeing in the putty session after I kill the process running the script:
/usr/cicjis/tools/shTranIdDoit[3624]: GetResolution[2220]: AddResolution[2249]: let: ErrorNoteOid=: more tokens expected

Any ideas would be greatly appreciated. I've been beating my head on this one all morning and half the afternoon yesterday.

Here is the fragment from the script that I believe is giving me the problem:
function AddResolution
{ ...
...
let ErrorNoteOid=$(AddErrorNote $TranId $MaxLineNo "$fLine") <--- This appears to be where the problem is
...
...
}

function AddErrorNote
{
print "Inside AddErrorNote"
...
...
)

Any help would be appreciated.
 
Old 01-11-2013, 05:06 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
probably the environment is different, something is not set (properly). You can use set -x to debug your script. That will give you more info about variables and commands...
 
Old 01-11-2013, 07:13 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.


Code:
let ErrorNoteOid=$(AddErrorNote $TranId $MaxLineNo "$fLine")
Well, assuming that this line really is the culprit, let initiates an arithmetic environment, so the right hand side needs to evaluate into a number. The "more tokens expected" error seems to indicate that it's not getting the proper number of arguments, so perhaps the AddErrorNote function isn't producing what it should. Have you tried echoing out the variables and testing the output of the function separately yet?

Other than that, it's impossible to say anything more with the meager amount of code and info you've given us.


BTW, it's generally recommended to use ((..)) or $((..)) for your arithmetic expressions instead of let.

Code:
(( ErrorNoteOid = $(AddErrorNote $TranId $MaxLineNo "$fLine") ))
ErrorNoteOid=$(( $(AddErrorNote $TranId $MaxLineNo "$fLine") ))
 
  


Reply



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
"Paste" output in Bash script not as expected... jb2011 Programming 15 05-19-2011 10:53 AM
[SOLVED] "Insert" & "Delete" key returns "~" in a terminal. sharky Linux - General 15 04-26-2011 08:36 AM
C++ - "snprintf" inside "for" doesn't work as expected. (int to char*) Repgahroll Programming 14 08-31-2010 08:27 AM
Grep in bash script returns "No such file or directory", works manually gizza23 Programming 7 02-25-2010 04:37 PM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:30 AM.

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
Open Source Consulting | Domain Registration