LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-16-2003, 04:52 PM   #1
sammathew
LQ Newbie
 
Registered: Jul 2003
Location: USA
Distribution: cpubuilders - Red Hat
Posts: 7

Rep: Reputation: 0
Shell Script that misbehaves under Linux but works in HP UX well... ksh environ.


Hello,

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: 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...
 
Old 09-16-2003, 06:03 PM   #2
contrasutra
LQ Guru
 
Registered: Mar 2003
Location: New Jersey
Distribution: Arch Linux
Posts: 1,445

Rep: Reputation: 46
It means one of your lines is formatted wrong.

It could be missing a (") or a (.) or many other "grammatical" mistakes.

Or you had a typo and added an extra mark that is out of place.

The: (unexpected `.') makes me think you have a (.) somewhere when you shouldn't.

Check line 128.
 
Old 09-16-2003, 06:13 PM   #3
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
That looks like a error message from the program rather than from ksh.

I believe (that works for sh) add a -v to the first line which probably reads
# /bin/ksh
so it reads
#! /bin/ksh -v

That will show all commands that are getting executed. (I'm not 100% sure with ksh, always program in sh).

Or you could find the line where this SquDex is executed, and modify it so it says

echo " <the original line> "
and put
exit

behind it, so you will see how and with which parameters that program would have been called. Then try executing the same thing on the command line and see what you get.


Hope it helps,
mlp
 
Old 09-17-2003, 01:46 PM   #4
sammathew
LQ Newbie
 
Registered: Jul 2003
Location: USA
Distribution: cpubuilders - Red Hat
Posts: 7

Original Poster
Rep: Reputation: 0
mlp,
Thanks. I think I saw the line where it is doing. It is taking a variable Bro and it is reading the value of that into another variable vBro. Bro should be integar, but somehow it came in as 0.00. How I can tell it to take only the integar value of it, like 0 only and not 0.00. Sorry for this silly question, but I am not a programmer.
Thanks
Regards
Sam
 
Old 09-17-2003, 05:16 PM   #5
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
If it's predictable that it's alway in the form x.y. and you always want x, you could do


Code:
vBro=` echo $vBro | awk -F. '{print $1}'`
(note the backquotes ``)

The awk splits the fields, using the dot as separator and gives you the first field (the first "0" in your case). But it might be easier to find out why the form is what it is.

Hope it helps,
mlp
 
Old 09-17-2003, 05:21 PM   #6
sammathew
LQ Newbie
 
Registered: Jul 2003
Location: USA
Distribution: cpubuilders - Red Hat
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks. I am a little bit afraid to open this program and make this sort of changes. If I send the two programs that uses this, will you be able to look at it?
Thanks
Bye
Sam
 
Old 09-17-2003, 06:23 PM   #7
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
Well, yes, but what does it do? Why don't you post the script if it's not too big and I can have a look.

mlp
 
Old 09-17-2003, 09:42 PM   #8
sammathew
LQ Newbie
 
Registered: Jul 2003
Location: USA
Distribution: cpubuilders - Red Hat
Posts: 7

Original Poster
Rep: Reputation: 0
mlp,
Thanks. IT comes to around 30 k as 4 files that are related. I guess we can't have attachments here in this forum. How can I send it. I think it will be too big for this place. I can e-mail it to you as an attachment. I can explain which program calls which also. Please let me know.
By the way, I tried your suggestion and it worked for one variable. I will have to do that for other three variables too looks like.... Thanks very much. But it bugs me why that error is coming at all. ...
Thanks
Bye
Sam
 
  


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
live cd with ksh default shell??? tgi Linux - Newbie 2 06-14-2005 11:47 PM
How to install Ksh shell hardeep_ubhi Linux - Newbie 1 02-03-2005 08:55 AM
Shell script works on RH 7.2 but not on RH ES brian Red Hat 1 08-31-2004 12:55 PM
Perl shell-out to script dunna work. Works on command line. Why? jlangelier Linux - Software 1 08-28-2004 03:00 AM
A C-shell script doesn't work on redhat 7.3 but works on Sun Solaris Belmer Linux - Newbie 2 02-08-2004 12:05 PM

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

All times are GMT -5. The time now is 11:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration