UNIX Korn Shell to Linux Bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX Korn Shell to Linux Bash
# 1  
Old 04-04-2018
UNIX Korn Shell to Linux Bash

Migrating Unix batch jobs (Korn Shell) running in HP-UX server to Linux environment.

Hi All

Please help me to understand the easiest way to migrate Kernel Shell scripts to Linux Bash. Also let me know
1. Any automated scripts or tools available for this.
2. Challenges and issues (performance, code change etc.)

Please help with your valuable suggestions.

Moderator's Comments:
Mod Comment Please post in correct forum!

Last edited by RudiC; 04-04-2018 at 04:10 AM.. Reason: Moved from "Post Here to Contact Site Administrators and Moderators "
# 2  
Old 04-04-2018
I would assume, althought not completely sure, that bash is compatible with ksh ( only in this direction, not the other way ).

What will be most likely the problem is the usage of external programs. Since HP-UX is a lot different to the linux environment, there could be a lot of change required, especially these kinds:
  • Some path names are different, hardcoded path names for programs will probably have to be changed
  • External commands have to partially be changed
  • invocation of commands with their options and switches are different and have to be adapted
The question to me is, if this is a onetime process or an extension, so that the scripts will run on both platforms in future. For the latter more work is required, to implement some kind of portability layer into all scripts.

Regarding automation, there is nothing I know of. I doubt that there is much regarding the fact that the issue is not to convert ksh syntax but a lot of external program calls, which is no question of converting one defined set of programming language syntax into another(like converting a perl script into c-code, which is possible and where converters exist), but a lot of arbitrary, non-standardized, redundant, ad-hoc code.

See also:
Bash / ksh - Portability Issues

Last edited by stomp; 04-04-2018 at 04:12 AM..
This User Gave Thanks to stomp For This Post:
# 3  
Old 04-04-2018
There are a few incompatibilities between ksh and bash that might need closer examination, like floating arithmetics, or array assignments, to name some of them.
# 4  
Old 04-04-2018
An option that may reduce porting work is to use ksh on linux.

My system (Linux: Debian 9 - Stretch) shows two available ksh packages here:
  • ksh - Real, AT&T version of the Korn shell
  • mksh - MirBSD Korn Shell

I'm not sure if on of these versions is really compatible with the HP-UX Version of ksh. But since ksh is open source since 2000 I would assume that this issue is safe.

difference between ksh, bash and other shells

Last edited by stomp; 04-04-2018 at 04:33 AM..
# 5  
Old 04-04-2018
Quote:
Originally Posted by stomp
My system (Linux: Debian 9 - Stretch) shows two available ksh packages here:
  • ksh - Real, AT&T version of the Korn shell
  • mksh - MirBSD Korn Shell

I'm not sure if on of these versions is really compatible with the HP-UX Version of ksh. But since ksh is open source since 2000 I would assume that this issue is safe.
The "mksh" is a freeware project which has more in common with bash than ksh but is compatible with neither one. My suggestion is: hands off! The other is a correct and specification-conforming ksh93, in version "u+" or thereabouts. You should use this at any rate.

There are also the sources for the Korn shell, which can be downloaded at Github (GitHub - att/ksh: KornShell Command and Programming Language), since AT&T discontinued to host it. This will guarantee you the latest version but you will have to compile it on your own. I suggest to use the Debian package if you use a Debian-based system. Similar packages with the compiled binaries can be downloaded from RedHat (for RedHat-based systems), etc..

I hope this helps.

bakunin
# 6  
Old 04-04-2018
Thank You all for your quick responses.

as of now we have around 5K batch jobs written using Korn Shell hosted in HP UX server.
we are planning to migrate all Korn Shell batch jobs to Linux Server (RedHat).

Will definitely verify the option shared by Stomp - using KSH in Linux

if as per our requirement, need to migrate all scripts to Linux bash...
Please let me know if any more additional inputs on this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Typeset is not working in Linux korn shell scripting

Hi All, Kindly help on the below issue ASAP. Its very urgent. I have script in which we have below two lines for code and it is not working. Please help. files_to_process=" abc_*.log def_*.log ghi_*.log " typeset -A dir_list ${files_to_process} the script is failing in Linux... (3 Replies)
Discussion started by: tvbhkishore
3 Replies

2. Homework & Coursework Questions

Linux/UNIX Bash Shell Script trouble help needed!!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 2. Shell Bash Script 3. !/bin/bash if echo no directory then mkdir -p /home/AC_Drywall elif ; then echo "$dir already exist" fi (4 Replies)
Discussion started by: TomFord1
4 Replies

3. Shell Programming and Scripting

security for unix korn shell script

hello I am using a korn shell script. I want to make them password protected. Please suggest some ways to do it. thanks in advance for your sufggestion ! (1 Reply)
Discussion started by: urfrnddpk
1 Replies

4. Shell Programming and Scripting

Difficulty with a couple commands porting from korn shell to bash

I am relatively new to shell scripting. I have a script I wrote that works fine in korn shell. I need to make it work in bash on a different server. There are a couple valid korn shell commands I am having difficulty finding the bash equivalents for. At one point the scripts prompts the... (5 Replies)
Discussion started by: inakajin
5 Replies

5. Shell Programming and Scripting

unix korn shell leap years problem

Write a function called dateToDays that takes three parameters -a month string such as Sep, a day number such as 18, and a year number such as 1962-and return s the number of days from January 1, 1900, to the date. Notes: I am asking you to account for leap years. my script is not... (0 Replies)
Discussion started by: babuda0059
0 Replies

6. UNIX for Dummies Questions & Answers

can a korn shell script be written on HP-UNIX?

Is HP UNIX and Korn different flavours of unix? can a korn shell script be written on HP Unix? (4 Replies)
Discussion started by: soujanya_srk
4 Replies

7. UNIX for Dummies Questions & Answers

korn shell to bash - statement not working

Everything else seems to be working, but this isn't. Is it the "cat..." that is wrong of the condition? Thanks. cat tc_result.txt | while read LINE do if then let "files_run += 1"; echo "inside the if loop" # save current filetype case $LINE... (5 Replies)
Discussion started by: brdholman
5 Replies

8. UNIX for Dummies Questions & Answers

practice tests- Unix Korn Shell Scripting

Hi, I am about to take certification for "Unix Korn Shell Scripting", which is conducted by brain bench. ( http://www.brainbench.com/xml/bb/common/testcenter/taketest.xml?testId=46) The test consists of 40 single and multiple choice questions that must be answered in 60 minutes. The pass mark... (0 Replies)
Discussion started by: eswasas
0 Replies

9. UNIX for Dummies Questions & Answers

Online UNIX emulator for Korn Shell scripting

Hi, I am very new to UNIX and I wanted to know if there is any online UNIX emulator in which I can practice Korn shell scripting. I have internet access, but my machine's OS is Windows XP. I just had my UNIX fundamental class and wanted to practice some shell scripting. I am not in a position to... (1 Reply)
Discussion started by: eswasas
1 Replies

10. Shell Programming and Scripting

Unix Korn Shell Array Issue (SunOS)

Hello, I'm currently messing around with arrays for the first time in scripting (Unix Korn Shell). All I'm trying to do right now before I make things complicated is read through and print out to screen whether the read file is or is not a directory. Here is my directory: ls -l total... (5 Replies)
Discussion started by: Janus
5 Replies
Login or Register to Ask a Question