Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, We are currently running our applications on AIX 5. We are moving to suseLinux. A lot of work in the automated build/deployment process is done through shell scripts. We ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    msk
    msk is offline
    Just Joined!
    Join Date
    Aug 2009
    Posts
    2

    porting shell scripts from AIX to Linux


    Hi,

    We are currently running our applications on AIX 5. We are moving to suseLinux.
    A lot of work in the automated build/deployment process is done through shell scripts. We want to know if there are any issues porting/running our shell scripts on Linux. Will these same scripts work on the suseLinux or we need to rewrite them altogether?

    Thanks!
    Santosh

    PS: I posted the same question on suse Linux Help.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,844
    It is, of course, against the forum rules to post the same question to multiple forums. But thanks for letting us know.

    If your version of AIX is running things through a standard shell, you may find that things almost work as you'd expect. Major differences may come with filesystem structure or with commands called from the scripts which may have different parameters, or even be replaced by different commands entirely.

    You may find it eaiser to set up a VM with SuSE on it just to try the scripts out. If you can find out what needs fixing very early in this project you'll have a better chance of straightening it out before your shiny new system goes live.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    msk,

    We have ported scripts to Linux but in our case is has been ksh scripts ported from Tru64 UNIX to Red Hat Linux. What Roxoff has mentioned is what we experienced. Such as:

    Verbose option for the rm command: in Linux it’s –v, in Tru64 it’s –e
    To send mail the command: in Linux it’s mail, in Tru64 it’s mailx

    Since we still use the same scripts on both Tru64 & Linux we added code in the beginning to check what the OS is and set variables for options and commands. For example:

    Code:
    if [ `uname` = “Linux” ]
       then rmver=”-v”
            mailcmd=”mail”
       else rmver=”-e”
            mailcmd=”mailx”
       fi
    The biggest problem to solve that we encountered was how variables are handled within while/read loops that have lines piped to them. For example:

    Code:
    cat $FLE | while read $LNE
        do
            CT=CT+1
        done
    The CT variable value is lost outside the loop. We had to change the scripts to not use pipes for the loops:
    Code:
    while read $LNE
        do
            CT=CT+1
        done < $_FILE
    Since bash is the default shell in Linux I have ported a few ksh scripts to bash without too much trouble.

  4. #4
    msk
    msk is offline
    Just Joined!
    Join Date
    Aug 2009
    Posts
    2
    Thank you for all your inputs. As you suggested we are planning in a phased process, meaning testing one piece at a time. Also most of our scripts are in bash, we are expecting less trouble while porting.

    Thanks again.

    I will make sure not to post in multiple forums in future.

  5. #5
    Just Joined!
    Join Date
    Aug 2012
    Posts
    4

    Unhappy migrating scripts from Korn shell to bash shell

    hi all,

    I have to migrate scripts from korn shell to bash shell, As i have change to linux platform, so please can u please help me with possible issues faced and any tools that can be help full.
    please share your experiances.

  6. #6
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,864
    Quote Originally Posted by syed_ahmed14 View Post
    hi all,

    I have to migrate scripts from korn shell to bash shell, As i have change to linux platform, so please can u please help me with possible issues faced and any tools that can be help full.
    please share your experiances.
    Please start a new thread with all the relevant info, this thread is several years old and will be closed.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •