Make a program ignore â.bashrcâ
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
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!
intel bashrc matlab
 |Â
show 2 more comments
up vote
2
down vote
favorite
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!
intel bashrc matlab
6
I'd put the statements into a separate file and source it only when needed for development.
â PerlDuck
Jun 1 at 10:39
... and only in the terminal window(s) where you intend to use the compilers, while the standard .bashrc will be used in other terminal windows.
â sudodus
Jun 1 at 10:41
+1 . . . or use the tools provided by your build system (such as placing them in a suitableMakefile
) - the nearest you will be able to do otherwise I think is to reset the ENTIRE environment e.g.Exec=env -i whatever
â steeldriver
Jun 1 at 10:43
What makes you think that "overriding system libraries might cause problems" is "crazy"? Anyways you can override the system variables again in a desktop icon if that's what you would like to do.
â Andrea Lazzarotto
Jun 1 at 11:08
@AndreaLazzarotto what I think is crazy is to constantly have to edit my bashrc file whenever I have to switch to MATLAB, not overriding system libraries. In fact, if you could explain how to do it in a desktop file that would be great!
â Mutewinter
Jun 1 at 13:49
 |Â
show 2 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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!
intel bashrc matlab
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!
intel bashrc matlab
asked Jun 1 at 10:34
Mutewinter
318318
318318
6
I'd put the statements into a separate file and source it only when needed for development.
â PerlDuck
Jun 1 at 10:39
... and only in the terminal window(s) where you intend to use the compilers, while the standard .bashrc will be used in other terminal windows.
â sudodus
Jun 1 at 10:41
+1 . . . or use the tools provided by your build system (such as placing them in a suitableMakefile
) - the nearest you will be able to do otherwise I think is to reset the ENTIRE environment e.g.Exec=env -i whatever
â steeldriver
Jun 1 at 10:43
What makes you think that "overriding system libraries might cause problems" is "crazy"? Anyways you can override the system variables again in a desktop icon if that's what you would like to do.
â Andrea Lazzarotto
Jun 1 at 11:08
@AndreaLazzarotto what I think is crazy is to constantly have to edit my bashrc file whenever I have to switch to MATLAB, not overriding system libraries. In fact, if you could explain how to do it in a desktop file that would be great!
â Mutewinter
Jun 1 at 13:49
 |Â
show 2 more comments
6
I'd put the statements into a separate file and source it only when needed for development.
â PerlDuck
Jun 1 at 10:39
... and only in the terminal window(s) where you intend to use the compilers, while the standard .bashrc will be used in other terminal windows.
â sudodus
Jun 1 at 10:41
+1 . . . or use the tools provided by your build system (such as placing them in a suitableMakefile
) - the nearest you will be able to do otherwise I think is to reset the ENTIRE environment e.g.Exec=env -i whatever
â steeldriver
Jun 1 at 10:43
What makes you think that "overriding system libraries might cause problems" is "crazy"? Anyways you can override the system variables again in a desktop icon if that's what you would like to do.
â Andrea Lazzarotto
Jun 1 at 11:08
@AndreaLazzarotto what I think is crazy is to constantly have to edit my bashrc file whenever I have to switch to MATLAB, not overriding system libraries. In fact, if you could explain how to do it in a desktop file that would be great!
â Mutewinter
Jun 1 at 13:49
6
6
I'd put the statements into a separate file and source it only when needed for development.
â PerlDuck
Jun 1 at 10:39
I'd put the statements into a separate file and source it only when needed for development.
â PerlDuck
Jun 1 at 10:39
... and only in the terminal window(s) where you intend to use the compilers, while the standard .bashrc will be used in other terminal windows.
â sudodus
Jun 1 at 10:41
... and only in the terminal window(s) where you intend to use the compilers, while the standard .bashrc will be used in other terminal windows.
â sudodus
Jun 1 at 10:41
+1 . . . or use the tools provided by your build system (such as placing them in a suitable
Makefile
) - the nearest you will be able to do otherwise I think is to reset the ENTIRE environment e.g. Exec=env -i whatever
â steeldriver
Jun 1 at 10:43
+1 . . . or use the tools provided by your build system (such as placing them in a suitable
Makefile
) - the nearest you will be able to do otherwise I think is to reset the ENTIRE environment e.g. Exec=env -i whatever
â steeldriver
Jun 1 at 10:43
What makes you think that "overriding system libraries might cause problems" is "crazy"? Anyways you can override the system variables again in a desktop icon if that's what you would like to do.
â Andrea Lazzarotto
Jun 1 at 11:08
What makes you think that "overriding system libraries might cause problems" is "crazy"? Anyways you can override the system variables again in a desktop icon if that's what you would like to do.
â Andrea Lazzarotto
Jun 1 at 11:08
@AndreaLazzarotto what I think is crazy is to constantly have to edit my bashrc file whenever I have to switch to MATLAB, not overriding system libraries. In fact, if you could explain how to do it in a desktop file that would be great!
â Mutewinter
Jun 1 at 13:49
@AndreaLazzarotto what I think is crazy is to constantly have to edit my bashrc file whenever I have to switch to MATLAB, not overriding system libraries. In fact, if you could explain how to do it in a desktop file that would be great!
â Mutewinter
Jun 1 at 13:49
 |Â
show 2 more comments
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
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.
1
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
@Mutewinter Good use ofexec
there ! Glad I could help :)
â Sergiy Kolodyazhnyy
Jun 4 at 9:00
add a comment |Â
up vote
3
down vote
This doesn't exactly answer your question about ignoring .bashrc
but I figured this could be a reasonable alternative:
Remove the statements needed for development from your ~/.bashrc
and put them in a separate file instead, e.g. ~/dev-env
:
#
# Set environment for icc compiler
#
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'
Then, when you want to develop something with the icc
compiler, simply source that file manually in the affected terminal window(s):
source ~/dev-env
The file doesn't need to be executable because you won't execute it but source it instead. This means the statements therein are processed by the current shell and hence affect the current shell. If you would make it executable and then execute it, a subshell would be spawned, the settings were set there and then the subshell would close. Not what you want.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
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.
1
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
@Mutewinter Good use ofexec
there ! Glad I could help :)
â Sergiy Kolodyazhnyy
Jun 4 at 9:00
add a comment |Â
up vote
4
down vote
accepted
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.
1
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
@Mutewinter Good use ofexec
there ! Glad I could help :)
â Sergiy Kolodyazhnyy
Jun 4 at 9:00
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
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.
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.
edited Jun 1 at 19:03
answered Jun 1 at 18:58
![](https://i.stack.imgur.com/U1Jy6.jpg?s=32&g=1)
![](https://i.stack.imgur.com/U1Jy6.jpg?s=32&g=1)
Sergiy Kolodyazhnyy
63.8k9127274
63.8k9127274
1
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
@Mutewinter Good use ofexec
there ! Glad I could help :)
â Sergiy Kolodyazhnyy
Jun 4 at 9:00
add a comment |Â
1
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
@Mutewinter Good use ofexec
there ! Glad I could help :)
â Sergiy Kolodyazhnyy
Jun 4 at 9:00
1
1
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
Thanks! I actually modified your answer for the desktop file to launch Matlab directly. My Exec is Exec = bash --noprofile --norc -c 'exec $PATHTOMATLAB/matlab' and it seems to be working fine!
â Mutewinter
Jun 4 at 8:14
@Mutewinter Good use of
exec
there ! Glad I could help :)â Sergiy Kolodyazhnyy
Jun 4 at 9:00
@Mutewinter Good use of
exec
there ! Glad I could help :)â Sergiy Kolodyazhnyy
Jun 4 at 9:00
add a comment |Â
up vote
3
down vote
This doesn't exactly answer your question about ignoring .bashrc
but I figured this could be a reasonable alternative:
Remove the statements needed for development from your ~/.bashrc
and put them in a separate file instead, e.g. ~/dev-env
:
#
# Set environment for icc compiler
#
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'
Then, when you want to develop something with the icc
compiler, simply source that file manually in the affected terminal window(s):
source ~/dev-env
The file doesn't need to be executable because you won't execute it but source it instead. This means the statements therein are processed by the current shell and hence affect the current shell. If you would make it executable and then execute it, a subshell would be spawned, the settings were set there and then the subshell would close. Not what you want.
add a comment |Â
up vote
3
down vote
This doesn't exactly answer your question about ignoring .bashrc
but I figured this could be a reasonable alternative:
Remove the statements needed for development from your ~/.bashrc
and put them in a separate file instead, e.g. ~/dev-env
:
#
# Set environment for icc compiler
#
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'
Then, when you want to develop something with the icc
compiler, simply source that file manually in the affected terminal window(s):
source ~/dev-env
The file doesn't need to be executable because you won't execute it but source it instead. This means the statements therein are processed by the current shell and hence affect the current shell. If you would make it executable and then execute it, a subshell would be spawned, the settings were set there and then the subshell would close. Not what you want.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
This doesn't exactly answer your question about ignoring .bashrc
but I figured this could be a reasonable alternative:
Remove the statements needed for development from your ~/.bashrc
and put them in a separate file instead, e.g. ~/dev-env
:
#
# Set environment for icc compiler
#
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'
Then, when you want to develop something with the icc
compiler, simply source that file manually in the affected terminal window(s):
source ~/dev-env
The file doesn't need to be executable because you won't execute it but source it instead. This means the statements therein are processed by the current shell and hence affect the current shell. If you would make it executable and then execute it, a subshell would be spawned, the settings were set there and then the subshell would close. Not what you want.
This doesn't exactly answer your question about ignoring .bashrc
but I figured this could be a reasonable alternative:
Remove the statements needed for development from your ~/.bashrc
and put them in a separate file instead, e.g. ~/dev-env
:
#
# Set environment for icc compiler
#
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'
Then, when you want to develop something with the icc
compiler, simply source that file manually in the affected terminal window(s):
source ~/dev-env
The file doesn't need to be executable because you won't execute it but source it instead. This means the statements therein are processed by the current shell and hence affect the current shell. If you would make it executable and then execute it, a subshell would be spawned, the settings were set there and then the subshell would close. Not what you want.
answered Jun 1 at 16:43
![](https://i.stack.imgur.com/kCmqs.png?s=32&g=1)
![](https://i.stack.imgur.com/kCmqs.png?s=32&g=1)
PerlDuck
3,62911030
3,62911030
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1042581%2fmake-a-program-ignore-bashrc%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
6
I'd put the statements into a separate file and source it only when needed for development.
â PerlDuck
Jun 1 at 10:39
... and only in the terminal window(s) where you intend to use the compilers, while the standard .bashrc will be used in other terminal windows.
â sudodus
Jun 1 at 10:41
+1 . . . or use the tools provided by your build system (such as placing them in a suitable
Makefile
) - the nearest you will be able to do otherwise I think is to reset the ENTIRE environment e.g.Exec=env -i whatever
â steeldriver
Jun 1 at 10:43
What makes you think that "overriding system libraries might cause problems" is "crazy"? Anyways you can override the system variables again in a desktop icon if that's what you would like to do.
â Andrea Lazzarotto
Jun 1 at 11:08
@AndreaLazzarotto what I think is crazy is to constantly have to edit my bashrc file whenever I have to switch to MATLAB, not overriding system libraries. In fact, if you could explain how to do it in a desktop file that would be great!
â Mutewinter
Jun 1 at 13:49