1.8 Using the Software Collection Version of a Command

To enable and use the version of a command that a software collection contains, use the scl utility with the enable action:

# scl enable sw_col -- command args

By default, the specified command from the software collection runs in a bash environment. If required, you can specify a different shell environment.

If you want to enable several software collections so that you can run several utilities together, specify bash to provide the environment from which you can access the utilities, for example:

# scl enable sw_col1 sw_col2 -- bash
Note

The X_SCLS environment variable contains a list of the currently enabled software collections in the shell.

You can specify the commands that you want to run in a software collection environment and pipe these to the scl command:

# cat cmd_file | scl enable sw_col -

You could also create an executable wrapper script to run an scl command, for example:

#!/bin/bash

scl enable php55 -- php $@

As of version 3.0, the scl utility can be called directly from the shebang (#!) line of a script with the enable action provided. This allows you to call an interpreter from within a collection directly from your scripts. For example:

#!/usr/bin/scl enable rh-python36 -- python

import platform 
import sys
import os

print(os.system('python -V'))
print(platform.python_version())
print(sys.version)

For more information, see the scl(1) manual page.