Hi,
Recently we migrated our app from Unix to Linux platform. All our shell scripts which use to work in Unix platform are not working in Linux now.
below is such sample script. I tried removing trailing spaces, but no luck. dear experts kindly help..
Please read the our FAQ on how to post new threads in the forums.
As a registered user you can go to any forum where you have permission to post and create new threads, view threads and leave replies. You should always search the forums before posting a new thread (Google Site Search).
To create a new thread, click on a forum you would like to post in, for example, UNIX for Dummies Questions & Answers, and then click on the new thread icon
To reply you have a few options. You can click on the 'Post Reply' button and add a new post to the end of the thread. Alternatively, you can leave a quick reply in a quick editor box listed below the posts in the thread.
If you have further questions on forum operations, do not send email or private messages (PMs) to us. You are required to post these questions here:
Except for a syntax error (missing "{" in the awk statement) that would fail on any platform I can't find any immediate need for action. Quite some potential for optimization, though.
Please post OS and shell version of both "Unix platform" and Linux.
EDIT: What does tcp_connect do? That might not be available on Linux...
Seriously: Which Unix system? Which Linux platform? What scripts?
My suspicion is that your Unix system used a certain default system shell (depending on the Unix systems type and version this could be a Bourne shell, Korn Shell, or even C-shell) and your new Linux system uses a different shell (depending on the specific type a "dash" or a "bash" most likely). This might lead to problems.
Another reason why your scripts fail is that they have no sort of environment explicitly set. Maybe you had some sort of standard-enviroment set in your old Unix box which is different (or non-existent) in your new box.
@RudiC: Sorry about that,
tcp_connect is stand alone program from appliction. it is available. i corrected syntax error "{". Still the issue exists
Issue is: when i run the script i see the error "line 37: syntax error: unexpected end of file"
Platform details are:
New: GNU/Linux 2.6.32-504.el6.x86_64, shell is /bin/bash
Old: Unix HP-UX B.11.31 U ia64, shell is /usr/bin/ksh
Sounds like a missing quote or a missing closing keyword somewhere, of which I can't find any in your sample.
Try running a skeleton script, remove all the echo es but one, don't redirect it, and post what happens.
@RudiC, I tried copy, paste each line by line.. then it works.
May be issue is with new line char, i am unsure! But i noticed one difference between HP-UX and Linux platforms. i.e., echo "\n" in unix (sh) prints new line but in Linux (ksh) echo "\n" prints \n as output.
Anyways, thanks for your suggestions it worked..
Actually this has nothing to do with your OS but everything with your shell. If i remember correctly HP-Ux uses a Korn shell as system default (not sure about that) and if this is the case then echo \n should indeed output "\n", as with the Linux ksh.
Use the print command instead of echo if you are working with the Korn shell.