Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:41:24+00:00 2026-06-05T06:41:24+00:00

I have the following problem: I have some test scripts that previously were run

  • 0

I have the following problem:

  • I have some test scripts that previously were run with ksh (from MKS Toolkit)
  • The scripts will need to remain unmodified (not a single character will be changed).
  • I will use bash (from Mingw/Msys) to run these scripts.

The problem is in the following:

This works fine in KornShell (ksh) but doesn’t work in bash:

typeset -i errorCode
errorCode=10
exit errorCode

I need to modify the script like this (note the $ sign):

typeset -i errorCode
errorCode=10
exit $errorCode

Is there a way to make the code to be compilable with bash without making the chnage I mentioned?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:41:25+00:00Added an answer on June 5, 2026 at 6:41 am

    you can also do this before executing the ksh script in bash

    #!/bin/bash
    exit ()
    {
        unset -f exit
        if expr match "$1" '^[-|+|0-9|.][.0-9]*$' &> /dev/null ; then
                exit "$1"
        fi
        exit
    }
    source ./the_ksh_script
    

    to override exit.
    This example is compatible with the original code, i.e. gives exit code of 0.

    Second example

    exit () {
     unset -f exit
     eval rc2=\$$1
     rc1=$1
     for rc in "$rc1" "$rc2"
      do
       if expr match "$rc" '^[-|+|0-9|.][.0-9]*$' &> /dev/null ; then
        exit "$rc"
       fi
      done
     exit
    }
    
    source ./the_ksh_script
    

    will produce the exit code 10, probably what the original script intends.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

basically i need some algorithm that fits into the following problem: i have 5
I have the following problem with Tikz/Latex: I have some nodes that contain text.
I have a following problem here: in my html structure I got some div's
Propose to consider the following problem. Suppose we have some composite object. Are there
i am new in JSP,i have some problem with the following code : <%@
Problem Scripts on some pages that use jquery are not activating. Scenario Finding that
I have the following problem. I am using Reporting Services 2005 to create some
I have the following problem and I hope someone will be able to help
have following problem with validate checkbox array. The validation is bypassed, have taken the
I have following problem: in my layout xml I have relative layout in which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.