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 7670251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:46:45+00:00 2026-05-31T15:46:45+00:00

I have an old version of a program sitting on my machine. This program

  • 0

I have an old version of a program sitting on my machine. This program recently had a version upgrade. The way I used to run my old program was by typing “runProgram”. The path to the runscript of my program was specified in my PATH variable as

PATH = ....:/path/to/my/old/programs/bin

I want to run the new version of this same program alongside my old program and the way I was thinking of doing it was by modifying my PATH variable as follows:

PATH = ....:/path/to/my/old/programs/bin:/path/to/my/new/programs/bin

What I want to achieve is some way to alias these two paths so that when I type ‘runVersion1’, the previous version is executed and when I type ‘runVersion2’, the new version is executed?

Is there a way to achieve that?

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-05-31T15:46:46+00:00Added an answer on May 31, 2026 at 3:46 pm

    If the program itself runs other programs from the bin directory, then when you run a version 1 program, you want to ensure that the version 1 directory is on the PATH ahead of the version 2 directory, and vice versa when you run a version 2 program. That is something I deal with all the time, and I deal with it by ensuring that the PATH is set appropriately.

    In my $HOME/bin, I would place two scripts:

    RunVersion1

     export PATH=/path/to/my/old/programs/bin:$PATH
     # Set other environment variables as needed
     exec runProgram "$@"
    

    RunVersion2

     export PATH=/path/to/my/new/programs/bin:$PATH
     # Set other environment variables as needed
     exec runProgram "$@"
    

    This technique of placing shell scripts on my PATH ahead of other programs allows me to pick which programs I run.

    Semi-Generic Version

    Often, I’ll use a single program to set the environment and then link it to the various program names that I want to handle. It then looks at $0 and runs that:

     export PATH=/path/to/my/new/programs/bin:$PATH
     # Set other environment variables as needed
     exec $(basename $0 2) "$@"
    

    If this script is linked to RunProgram2, the basename command lops off the 2 from the end of RunProgram2 and then executes RunProgram from the more recent directory.

    I’ve used this general technique for accessing 32-bit and 64-bit versions of the software on a single machine, too. The programs I deal with tend to have more complex environments than just a setting of $PATH, so the scripts are bigger.

    One of the main advantages of scripts in $HOME/bin over aliases and the like is that it doesn’t much matter which shell I’m stuck with using; it works the same way. Plus I don’t have so many places to look to find where the alias is defined (because it isn’t defined).

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

Sidebar

Related Questions

Currently I have to uninstall the old version of my service before I install
I have successfully upgraded an MFC application which was compiled with an old version
I have an ActiveX control that runs on a website, where the old version
I have an old server with a defunct evaluation version of SQL 2000 on
I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But
I have an Infragistics UltraNumericEditor (version 5.3, quite old) control on a form. If
I have some queries being run in a java program that makes use of
I have run into this problem a lot in the past, but never really
I have a build script that pulls the old version out of the plist
I have an XML schema that was built with an old version of the

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.