# Ubuntu – Make a program ignore “.bashrc”

bashrcintelMATLAB

Sorry if it is an extremely stupid noob question, but I am not an expert and I cannot find any adequate response on this or other forums.

I am running Ubuntu 18.04 x64 and I'm working with Intel Compilers. In order to keep my system and the compilation of my software consistent I've set my .bashrc to set the Intel compilers as default.

source /opt/intel/parallel_studio_xe_2018.2.046/bin/psxevars.sh
export CC='/opt/intel/bin/icc'
export CXX='/opt/intel/bin/icpc'
export FC='/opt/intel/bin/ifort'
export F77='/opt/intel/bin/ifort'
export CFLAGS='-O3 -xHost -ip'
export CXXFLAGS='-O3 -xHost -ip'
export FCFLAGS='-O3 -xHost -ip'


Now, if I do this I cannot start MATLAB R2017b. Every time I start it it clashes with the Intel compilers and aborts the startup with the error:

symbol lookup error: /opt/intel/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64/libirng.so: undefined symbol: __intel_skx_avx512_memcpy


The only way I have to get MATLAB to work is to comment out the above variables in my .bashrc file, source it and start MATLAB.

This of course crazy and I was wondering if it was possible to actually have, for example, a .desktop files that ignores .bashrc or if there's any other way to have those environmental variables up and running, but have a software ignoring them.

Thanks!

It is indeed possible to start bash with ignoring the ~/.bashrc file. Specifically, via --no-rc flag:

 bash --noprofile --norc


You can make a wrapper .desktop file for that in a fairly simple way:

[Desktop Entry]
Version=1.0
Name=No-rc shell
Comment=Starts Bash with --no-rc flag
Exec=bash --noprofile --norc
Icon=/usr/share/icons/gnome/48x48/apps/terminal.png
Terminal=true
Type=Application
Categories=Utility;Development;


Alternatively, you could modify the ~/.bashrc in such way, that would allow you sourcing it dynamically. For instance, I'd personally do something like this:

if [ -z "$no_intell_compilers" ][ "$no_intell_compilers" = "false" ]; then
source /opt/intel/parallel_studio_xe_2018.2.046/bin/psxevars.sh
export CC='/opt/intel/bin/icc'
export CXX='/opt/intel/bin/icpc'
export FC='/opt/intel/bin/ifort'
export F77='/opt/intel/bin/ifort'
export CFLAGS='-O3 -xHost -ip'
export CXXFLAGS='-O3 -xHost -ip'
export FCFLAGS='-O3 -xHost -ip'
fi


What this does is that it checks for environment variable no_intell_compilers; if it is unset or set to false, ~/.bashrc will export those variables. When you want to start over without those variables in the environment, do

$no_intell_compilers="true"$ source ~/.bashrc


Once you're done developing in that shell, just unset no_intell_compilers and source the file again to have the variables back.