DEV Community

Cover image for Switching between binaries
Austin Cunningham
Austin Cunningham

Posted on • Edited on

2 1

Switching between binaries

I am constantly changing my binaries for installation prerequisites and testing. I used to spend a bit of time change paths or updating .bashrc . This is a quick example of a bit of bash I used to reduce the manual steps involve around changing the oc binary(Openshift command line binary). Currently I have four versions of the oc binary on my PC 3.7, 3.9, 3.10 and 3.11, I put each binary in its own directory in /opt/openshift

I have the oc binary sym-linked at /usr/local/bin/oc so I only need to change where the sym-link is pointing. This script checks the current version that is sym-linked , list the versions present on the PC , asks you what version you wish to install and removes the existing sym-link and adds an new one.

#!/bin/bash
echo "########################################################################################"
echo Current version of oc
ls -la /usr/local/bin/oc
echo "########################################################################################"
echo Versions of openshift oc on the system
ls /opt/openshift
echo "########################################################################################"
echo "What version do you wish to install ?"
read version
sudo rm /usr/local/bin/oc
sudo ln -s /opt/openshift/$version/oc /usr/local/bin/oc
echo " "
echo "########################################################################################"
oc version
echo " "
echo "########################################################################################"
Enter fullscreen mode Exit fullscreen mode

Once you have your script written you can make it executable by changing the Linux permissions

chmod u+x change_oc.sh
Enter fullscreen mode Exit fullscreen mode

It can then be run

./change_oc.sh
Enter fullscreen mode Exit fullscreen mode

Running it looks like this

Myblog

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up