What's the purpose of having “env [shell]” as an interpreter? [duplicate]

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











up vote
0
down vote

favorite













This question already has an answer here:



  • Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?

    9 answers



I already stumbled over #!/usr/bin/env bash on numerous occasions and never questioned it. Now, I'm wondering what the purpose of wrapping the shell interpreter in an env command, i.e. why not just write #!/bin/bash, #!/bin/sh or whatever?










share|improve this question













marked as duplicate by sebasth, Ipor Sircer, Thomas, Thomas Dickey, Community♦ yesterday


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















    up vote
    0
    down vote

    favorite













    This question already has an answer here:



    • Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?

      9 answers



    I already stumbled over #!/usr/bin/env bash on numerous occasions and never questioned it. Now, I'm wondering what the purpose of wrapping the shell interpreter in an env command, i.e. why not just write #!/bin/bash, #!/bin/sh or whatever?










    share|improve this question













    marked as duplicate by sebasth, Ipor Sircer, Thomas, Thomas Dickey, Community♦ yesterday


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite












      This question already has an answer here:



      • Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?

        9 answers



      I already stumbled over #!/usr/bin/env bash on numerous occasions and never questioned it. Now, I'm wondering what the purpose of wrapping the shell interpreter in an env command, i.e. why not just write #!/bin/bash, #!/bin/sh or whatever?










      share|improve this question














      This question already has an answer here:



      • Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?

        9 answers



      I already stumbled over #!/usr/bin/env bash on numerous occasions and never questioned it. Now, I'm wondering what the purpose of wrapping the shell interpreter in an env command, i.e. why not just write #!/bin/bash, #!/bin/sh or whatever?





      This question already has an answer here:



      • Why is it better to use “#!/usr/bin/env NAME” instead of “#!/path/to/NAME” as my shebang?

        9 answers







      shell-script shell environment-variables interpreter






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Karl Richter

      7031822




      7031822




      marked as duplicate by sebasth, Ipor Sircer, Thomas, Thomas Dickey, Community♦ yesterday


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by sebasth, Ipor Sircer, Thomas, Thomas Dickey, Community♦ yesterday


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I think this became popular because of python.



          With this you can do



          #!/usr/bin/env python3


          for example and be quite sure env will find the right version and location for the executable.



          Then this migrated to other shells because it seems like a good practice to always do even if you know where that particular shell is.






          share|improve this answer



























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I think this became popular because of python.



            With this you can do



            #!/usr/bin/env python3


            for example and be quite sure env will find the right version and location for the executable.



            Then this migrated to other shells because it seems like a good practice to always do even if you know where that particular shell is.






            share|improve this answer
























              up vote
              0
              down vote













              I think this became popular because of python.



              With this you can do



              #!/usr/bin/env python3


              for example and be quite sure env will find the right version and location for the executable.



              Then this migrated to other shells because it seems like a good practice to always do even if you know where that particular shell is.






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                I think this became popular because of python.



                With this you can do



                #!/usr/bin/env python3


                for example and be quite sure env will find the right version and location for the executable.



                Then this migrated to other shells because it seems like a good practice to always do even if you know where that particular shell is.






                share|improve this answer












                I think this became popular because of python.



                With this you can do



                #!/usr/bin/env python3


                for example and be quite sure env will find the right version and location for the executable.



                Then this migrated to other shells because it seems like a good practice to always do even if you know where that particular shell is.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                mikst

                967




                967












                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay