Make a program ignore “.bashrc”

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








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!







share|improve this question















  • 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














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!







share|improve this question















  • 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












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!







share|improve this question











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!









share|improve this question










share|improve this question




share|improve this question









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 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












  • 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







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










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.






share|improve this answer



















  • 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 of exec there ! Glad I could help :)
    – Sergiy Kolodyazhnyy
    Jun 4 at 9:00

















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.






share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    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






























    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.






    share|improve this answer



















    • 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 of exec there ! Glad I could help :)
      – Sergiy Kolodyazhnyy
      Jun 4 at 9:00














    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.






    share|improve this answer



















    • 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 of exec there ! Glad I could help :)
      – Sergiy Kolodyazhnyy
      Jun 4 at 9:00












    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.






    share|improve this answer















    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.







    share|improve this answer















    share|improve this answer



    share|improve this answer








    edited Jun 1 at 19:03


























    answered Jun 1 at 18:58









    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 of exec there ! Glad I could help :)
      – Sergiy Kolodyazhnyy
      Jun 4 at 9:00












    • 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 of exec 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












    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.






    share|improve this answer

























      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.






      share|improve this answer























        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.






        share|improve this answer













        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.







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Jun 1 at 16:43









        PerlDuck

        3,62911030




        3,62911030






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            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













































































            Popular posts from this blog

            pylint3 and pip3 broken

            Missing snmpget and snmpwalk

            How to enroll fingerprints to Ubuntu 17.10 with VFS491