General
cancel
Showing results for 
Search instead for 
Did you mean: 

Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

SOLVED
Go to solution
Samuel Mathew
Frequent Advisor

Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Hello,
I had put this question earlier on this forum and couldnt get a reply. I am not able to solve it myself and hence this attempt once more. Please see if anybody has any wise words for me.
I have this long shell script that I have ported to Linux from HPUX. It is running fine on HPUX. I am running it under ksh in both the places.
On Linux it gives me an error message that doesn't give me any clue to what is happening. The error message is this.
SquDex: binLinux/Milling[128]: 0.00: unexpected `.'
SquDex is the main program that I started and binLinux/Milling is the other program it calls in between. I have no idea what this means: 0.00: unexpected `.'
I tried to run set -vx, but that doesn't give me any clue. Is there a way to run shell scripts line by line and debug?
Or does anybody have any clue what such an error means?
THe program runs and gives me the out put but since this error message is coming, I cant run the program in the production env. Please let me know if anybody has any suggestions...
Regards
Thanks in anticipation...
11 REPLIES
Steven E. Protter
Exalted Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Post the script.

Check that the shell statement at the top is valid.

I do not recall your earlier thread. I have never met a HP script I could not port to Linux or vice versa.

I will check the thread later.

If I help, please assign points. I'm in quite a Linux drought lately, lots of thank you's 10 points this week total.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Browne
Honored Contributor
Solution

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

This thread rings bells.. I remember going through parts of this, finding/fixing 5-6 points where problems occured, and posting back, then we didn't hear from you again.

There are something liek 5-6 different scritps in total, including various Awk routiens, is that correct?

I remember posting back a fixed routine (for the segment posted), but havnig no test data, I couldn't confirm everything.
One long-haired git at your service...
David Asgeirsson
Valued Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Just my opinion, but the error message seems to say that the floating point number 0.00 is invalid, no decimal place expected. So try the integer value 0 instead...
Samuel Mathew
Frequent Advisor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Steven/Staurt/David,
I didn't get any of the scripts back. I am attaching four of the scripts. SquDex is the first one to be run. This calls the Squaring and then it calls the Milling and from there GenMIll is called. I can see the parameters getting assigned the 0.00 values. I ran the script with set -xv on the first line in 'Milling' program and if you see this is where it gets the problem.
>> Kiwa3_Squaring.nc
+ binLinux/GenMill Kiwa3 RotBro 1 0 1 0.00
+ echo 0.00
+ gawk -F. {print $1}
+ Bro1=0
+ gawk -vOp=1 -vOffset=0.0,0.0,0.0 -vBro=0 -vSafeZ=11.2912 -vBlk=0 -f awk/Position usr/Kiwa3_Squaring.par usr/Kiwa3_Station#1.par FixLib
+ WriteOps
./SquDex: binLinux/Milling[129]: 0.00: unexpected `.'
./SquDex: binLinux/Milling[129]: 0.00: unexpected `.'
+ ReadOpLine 2 1

The last two lines are the errors. I am attaching the tar file that contains the four programs. I hope if I can define that as integar the problem may be over.
THanks for the help
Regards
Stuart Browne
Honored Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Modify 'Milling', throw '-x' on the end of the #! line. Re-run, see what gets passed where.
One long-haired git at your service...
Samuel Mathew
Frequent Advisor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Stuart,
Thanks. The output shown in my previous e-mail is the result of putting -x
Kiwa3_Squaring.nc
+ binLinux/GenMill Kiwa3 RotBro 1 0 1 0.00
+ echo 0.00
+ gawk -F. {print $1}
+ Bro1=0
+ gawk -vOp=1 -vOffset=0.0,0.0,0.0 -vBro=0 -vSafeZ=11.2912 -vBlk=0 -f awk/Position usr/Kiwa3_Squaring.par usr/Kiwa3_Station#1.par FixLib
+ WriteOps
./SquDex: binLinux/Milling[129]: 0.00: unexpected `.'
./SquDex: binLinux/Milling[129]: 0.00: unexpected `.'
+ ReadOpLine 2 1

The output RotBro 1 0 1 0.00 and the vOffset=0.0,0.0,0.0 are the ones that cause the errors below that I guess.(My guess is not very good as I don't have much insight into shell scripts). MY question will be to how to get them to be '0' rather than 0.0. Where I do define the variable associated with them to be integers with out decimal places. One thing that I didn't understand is why they ran ok in HP-UX, but has this problem in Linux. COuld it be because of anything else. If so, what and how could I get over it?
Thanks for the inputs. I will remember to assign points

Stuart Browne
Honored Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Where does '$Bro' get set?
One long-haired git at your service...
Steven E. Protter
Exalted Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Basics:

Have you changed the shell from /bin/ksh or do you have a shell on your system.

The first thing I always do to a script in conversion is change that.

Of course it would have failed before line 91 in that case.

I recently fixed an HP-UX script that was using the shift command to wipe out its $1 and $2 variables. Nothing like that here.

Could there be an extraneous character in the script tripping it up. The error almost looks like when the closed quotes is missing in a script.

echo "schmo bagel

instead of

echo "schmo bagel"

Its not that simple, but one nasty little inviviible character can mess it up.

I've finally gotten to downloading the script and am attempting to run it.

I just run it ./Milling

No command line parameters?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Samuel Mathew
Frequent Advisor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Stuart,
$Bro gets set in GenMill as I understand
Steven,
Yes, I have set up /bin/ksh as my environment. I have ksh running.
The first script to run is SquDex. That calls Milling and then GenMill and Squaring. Since you don't have a lot of the data files, it may give errors. But I am not sure if that will stall everything. To send the data files, it will be impossible as it will run into many MBs.
As you suggested I also suspect some where " is missing. But how do I find that? Is there any way, to match it using a debug program?
Thanks for your help. I look forward to hearing something more on this.
Regards
Steven E. Protter
Exalted Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

What you need in this case is an editor with a syntax checker, preferably one that highlights and color codes the code.

There is a mistake, and I can't find it visually.

So.

In Linux, you might try tucows.com and search for editor shell. You are likekly to find a no cost program that will do the job in your X-Windows or even telnet/ssh environment.

If that doesn't work tucows or download.com has a few tools for windows that might help.

Same search critera. I've got some manual labor on the hold homestead(backyard) so I won't get to looking for a tool for a day or so.

Good Luck.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Browne
Honored Contributor

Re: Error message on Shell Program in Linux (this runs perfectly under HP-UX 10.20)

Make sure the lines don't end with a CR (^M).

The only other time I've seen unreasonable results is when that occurs.

As for $Bro, no, it's not set in GenMill, it gets passed to it from Milling.

Milling:91: binLinux/GenMill $Mill RotBro $Stat $Blk $OpN $Bro

One long-haired git at your service...