AIX UNIX (kshell) to Linux Shell Script Migration.
Hi,
Could you please let me know what kind of changes/issues commonly occurs at Scripting /command level during AIX Unix (kshell) to Linux shell script migration.
AIX has a ksh88 as system shell and a ksh93 in /usr/bin/ksh93 Korn Shell (the real ksh - not "pdksh" and similar clones with heavy shortcomings) is available as free software and you should be able to get a package suitable for your system (.deb or .rpm, most probably) and install it.
There should be no difference betwwen the Korn Shell on AIX and any other ksh.
So you suggeste to install ksh88 , ksh93 on new Linux Server inorder to have existing Application Scripts to work fine.
Basically: yes. There might probably be no ksh88 package any more, but because ksh93 is downwards compatible with ksh88 you can install ksh93 and everything should run fine.
Of course "run fine" only means that the shell syntax is fine. If you use a AIX-specific command (like "lsuser", for instance) or option (AIX grep has a "-p" option the standard grep lacks, for instance) somewhere you will get an error saying "command not found" or "illegal soption" or something such.
If you want to make your scripts work in bash, I am currently doing a migration from AIX to RHEL and we've found these issues:
- Variables in AIX inside a test can be without a preceding "$". (This won't work in Linux, so you have to insert a "$" before each variable in a test. Another solution is duplicate "[[" instead of leaving "[ ]" for your test.)
- Depends on the code, in my case I have found lots of variables comparing strings without being between double quotes, so we have decided to put double quotes for all variables comparing strings.
- You have to change the extension of your scripts that are .ksh into .sh. Be aware that you have to modify all your cronjobs and all your scripts that are being called by other applications (like Control-M) if you still want them to function as they did.
- You have to change the shebang for #!/bin/bash or #!/bin/sh or #!/usr/bin/env sh
I don't know which Linux distribution, but be aware of sh and dash for Debian/Ubuntu.
- You have to change the path for commands like, I had something like this in AIX:
/usr/bin/fuser
and now it has to be changed into
/bin/fuser
Same for mailx.
- We also had to look for all the executables in C and make sure it all works as they used to.
- We also searched all the sqlplus calls to test all the database related things.
- We had to find out a way to have which script depends on another script and which scripts are the parent scripts.
- We used sh -x to execute each script to search for anything strange or any possible errors.
- We made a copy of each script and then we commented each loop and test so we could execute each action of the script and see if any errors came.
- tail -n +2 but without -n doesn't work in Linux.
- We have found a few variables that were not declared and this was because someone forgot to change it in an old migration they did from HP-UX to AIX.
- Be aware of the environment variables.
- We created the whole structe in the new machine, first without caring about permissions.
It's been a long time since I did a big project to convert AIX scripts to RHEL. I do remember having some trouble with echo statements not expanding the backslash characters (like \n) for example:
I believe this was related to /bin/sh just being a symbolic link to bash but running in "strict compatibility" mode. However, we found that turning on shopt -s xpg_echo at the top of the script was usually enough to get the echo statements working as they used to and much less time consuming than converting everything to use printf.
Also watch out for anything that directly interacts with the /dev device files. as almost certainly they will be named differently that the AIX devices. Think here about accessing DVD/CD device or backup tape drives or changers.
Our backup scripts needed to be re-written as they used commands like sysback and tape to interact with tape libraries/changers and things were just too different under AIX, we decided rather than redevelop this it was easier to implement a commercial backup solution (I think it was CommVault), this came with an agent that managed most of the I/O and we only need to develop little stub scripts that were called to do things like stop the database or do an on-line backup to a file.
I think I had to do a conversion of echo to print & printf
Have a good think about your DR provision too. There is no mksysb equivalent on Linux (HP has Ignite, etc.) You may have read that you just kickstart your replacement server, but you would have to get your kickstart-server recovered first (if you lose the site) and the it's only going to put you to the install state if that's how you first built it. All your patches and customisations would need to be done again, perhaps with software installs (if they write into the boot volume group such as Oracle)
Hi,
recently we have migrated our current AIX server to Linux, we have lot of shell script, few of them are FTP scripts.
we have copied the complete AIX file system to linux 7.2 as it is.
could you please highlight what are the things we need to look into it .
in AIX we are using .netrc to... (3 Replies)
I'm New to AIX / VIOS
We're doing a FC switch cutover on an ibm device, connected via SAN.
How do I tell if one path to my remote disk is lost? (aix lvm)
How do I tell when my link is down on my HBA port?
Appreciate your help, very much! (4 Replies)
We have certain number of scripts that run on AIX server using ksh.
Now that we migrate these scripts to Linux servers.
We need to know what are the changes that we have to perform in script to make it compatible to run on Linux.
Say like in our Unix -AIX "print" command worked.
But that did... (6 Replies)
We are changing our OS from HP-Unix 11 to Linux Red Hat. We have few k- shell, c - shell and sql scripts which are currently running under HP-Unix 11. Will these scripts work on LINUX as it is? or we need to do any code changes?IS there anyone who have done this kind of migration before?Thanks for... (2 Replies)
Hi All,
I am currently facing new problem of migrating C(c language) application from AIX machine to Linux machine. We are using GCC to compile the source code..
But facing with the compilation issues, with lot of GCC C libs differing between AIX box to Linux box...
Pls help me... (1 Reply)
Hi All,
I am currently facing new problem of migrating C(c language) application from AIX machine to Linux machine. We are using GCC to compile the source code..
But facing with the compilation issues, with lot of GCC C libs differing between AIX box to Linux box...
Pls help me... (1 Reply)
Dear All,
What points should i keep in mind while migrating scripts from HP-UX to AIX.
Are there any notes available for this?
cheers,
vishal (1 Reply)
I am trying to set some environment variables in a shell script which is written in Kshell. I am invoking this script in .profile. The problem is envirnment variables are set within the script but after exiting the script those are gone. I don't have any problem with If I have Kshell as my default... (0 Replies)
hi all
i m working in a company ...and i have to migrate a C application running on SCO-UNIX to Red hat linux.
can anybody tell me what is the difference between C commands and shell scripting on SCO-UNIX and LINUX.
best regards
harsh (3 Replies)