3

I have a bash script that executes the command

scl enable devtoolset-8 'echo -e "%__ld $(which ld)\n%__nm $(which nm)\n%__objcopy $(which objcopy)\n%__objdump $(which objdump)\n%__strip $(which strip)"'

After completing the assembly, I need to "turn off" gcc-8.

How can I do this by means of bash?

asked Oct 20, 2020 at 16:09

1 Answer 1

3

You don't need to turn anything "off" after the above command, all that it does is prints paths of the main devtoolset executables, e.g.

%__ld /opt/rh/devtoolset-8/root/usr/bin/ld
%__nm /opt/rh/devtoolset-8/root/usr/bin/nm
%__objcopy /opt/rh/devtoolset-8/root/usr/bin/objcopy
%__objdump /opt/rh/devtoolset-8/root/usr/bin/objdump
%__strip /opt/rh/devtoolset-8/root/usr/bin/strip

When you run a most used scl enable devtoolset-8 bash command, it is invokes a new bash instance where you have an additional path in your $PATH enviroment variable making all the development tools now run from the new location:

[user@hostname ~]$ echo $PATH
/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
[user@hostname ~]$ scl enable devtoolset-8 bash
[user@hostname ~]$ echo $PATH
/opt/rh/devtoolset-8/root/usr/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
[user@hostname ~]$

All you need to "turn off" the devtoolset is to exit this bash instance:

[user@hostname ~]$ exit
exit
[user@hostname ~]$ echo $PATH
/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
[user@hostname ~]$
answered Feb 2, 2022 at 17:05
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.