How to run the “other” executable matching the same name found in PATH? The 2019 Stack...

Can we generate random numbers using irrational numbers like π and e?

How to display lines in a file like ls displays files in a directory?

What is this business jet?

A female thief is not sold to make restitution -- so what happens instead?

Deal with toxic manager when you can't quit

Can there be female White Walkers?

How much of the clove should I use when using big garlic heads?

Why not take a picture of a closer black hole?

writing variables above the numbers in tikz picture

How did passengers keep warm on sail ships?

How do PCB vias affect signal quality?

What do I do when my TA workload is more than expected?

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

Does HR tell a hiring manager about salary negotiations?

Is Cinnamon a desktop environment or a window manager? (Or both?)

How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

The phrase "to the numbers born"?

If my opponent casts Ultimate Price on my Phantasmal Bear, can I save it by casting Snap or Curfew?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

Match Roman Numerals

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Why couldn't they take pictures of a closer black hole?

Can withdrawing asylum be illegal?



How to run the “other” executable matching the same name found in PATH?



The 2019 Stack Overflow Developer Survey Results Are Intips about easy alternative/management of PATH in windowsHow can you find out where an executable is resolved from on the command line?how did git add itself to the PATH on OSX 10.6 ? It's not in bashrc or profile?To set PATH on OS X when export PATH= don't workWindows Command Line: 'not recognized as an internal or external command, operable program or batch file.'How to add installed program to command prompt in windows?pip not working on hombrew python 2.7 installPath Environment Variable not workingHow to make a bash script ask the user for a directory and if it's not found, ask againIssue Embedding Git Bash in RoyalTS





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Is there a concise way to call the "other" executable for find available in path that can be found with where?



C:repos>where find
C:WindowsSystem32find.exe
C:Program FilesGitusrbinfind.exe
C:UsersQwertycmdUnxUtils_wbinfind.exe


For example something like find~2 or wannabe whereget find -n 2 -- <arguments for find here>










share|improve this question





























    0















    Is there a concise way to call the "other" executable for find available in path that can be found with where?



    C:repos>where find
    C:WindowsSystem32find.exe
    C:Program FilesGitusrbinfind.exe
    C:UsersQwertycmdUnxUtils_wbinfind.exe


    For example something like find~2 or wannabe whereget find -n 2 -- <arguments for find here>










    share|improve this question

























      0












      0








      0








      Is there a concise way to call the "other" executable for find available in path that can be found with where?



      C:repos>where find
      C:WindowsSystem32find.exe
      C:Program FilesGitusrbinfind.exe
      C:UsersQwertycmdUnxUtils_wbinfind.exe


      For example something like find~2 or wannabe whereget find -n 2 -- <arguments for find here>










      share|improve this question














      Is there a concise way to call the "other" executable for find available in path that can be found with where?



      C:repos>where find
      C:WindowsSystem32find.exe
      C:Program FilesGitusrbinfind.exe
      C:UsersQwertycmdUnxUtils_wbinfind.exe


      For example something like find~2 or wannabe whereget find -n 2 -- <arguments for find here>







      windows bash unix-utils






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      QwertyQwerty

      299313




      299313






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Calling an executable without the full path will always find and use the first matching filename by searching the directories in $PATH. For your example, if you always want to use the git find, simply ensure that the path to it appears in your $PATH before the Windows find. If this is unsatisfactory or impossible (e.g., due to policy), you should either create an alias in bash for it, or always call it using the full pathname.






          share|improve this answer
























          • Alias is a great idea, thanks!

            – Qwerty
            yesterday



















          0














          I will just put it here



          $ alias whereget='_whereget() { A=$1; B=$2; shift 2; eval "$(where $B | head -$A | tail -1)" $@; }; _whereget'
          $ whereget 2 find . -type d


          Unfortunately this solution only works in bash, not in Windows cmd.






          share|improve this answer
























          • The alias won't work either in a bash script.

            – xenoid
            yesterday











          • Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

            – Qwerty
            20 hours ago






          • 1





            Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

            – xenoid
            18 hours ago











          • Right, then I will put it to ~/.bashrc file

            – Qwerty
            16 hours ago











          • won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

            – xenoid
            16 hours ago












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1423785%2fhow-to-run-the-other-executable-matching-the-same-name-found-in-path%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Calling an executable without the full path will always find and use the first matching filename by searching the directories in $PATH. For your example, if you always want to use the git find, simply ensure that the path to it appears in your $PATH before the Windows find. If this is unsatisfactory or impossible (e.g., due to policy), you should either create an alias in bash for it, or always call it using the full pathname.






          share|improve this answer
























          • Alias is a great idea, thanks!

            – Qwerty
            yesterday
















          1














          Calling an executable without the full path will always find and use the first matching filename by searching the directories in $PATH. For your example, if you always want to use the git find, simply ensure that the path to it appears in your $PATH before the Windows find. If this is unsatisfactory or impossible (e.g., due to policy), you should either create an alias in bash for it, or always call it using the full pathname.






          share|improve this answer
























          • Alias is a great idea, thanks!

            – Qwerty
            yesterday














          1












          1








          1







          Calling an executable without the full path will always find and use the first matching filename by searching the directories in $PATH. For your example, if you always want to use the git find, simply ensure that the path to it appears in your $PATH before the Windows find. If this is unsatisfactory or impossible (e.g., due to policy), you should either create an alias in bash for it, or always call it using the full pathname.






          share|improve this answer













          Calling an executable without the full path will always find and use the first matching filename by searching the directories in $PATH. For your example, if you always want to use the git find, simply ensure that the path to it appears in your $PATH before the Windows find. If this is unsatisfactory or impossible (e.g., due to policy), you should either create an alias in bash for it, or always call it using the full pathname.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          Jeff ZeitlinJeff Zeitlin

          1,554618




          1,554618













          • Alias is a great idea, thanks!

            – Qwerty
            yesterday



















          • Alias is a great idea, thanks!

            – Qwerty
            yesterday

















          Alias is a great idea, thanks!

          – Qwerty
          yesterday





          Alias is a great idea, thanks!

          – Qwerty
          yesterday













          0














          I will just put it here



          $ alias whereget='_whereget() { A=$1; B=$2; shift 2; eval "$(where $B | head -$A | tail -1)" $@; }; _whereget'
          $ whereget 2 find . -type d


          Unfortunately this solution only works in bash, not in Windows cmd.






          share|improve this answer
























          • The alias won't work either in a bash script.

            – xenoid
            yesterday











          • Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

            – Qwerty
            20 hours ago






          • 1





            Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

            – xenoid
            18 hours ago











          • Right, then I will put it to ~/.bashrc file

            – Qwerty
            16 hours ago











          • won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

            – xenoid
            16 hours ago
















          0














          I will just put it here



          $ alias whereget='_whereget() { A=$1; B=$2; shift 2; eval "$(where $B | head -$A | tail -1)" $@; }; _whereget'
          $ whereget 2 find . -type d


          Unfortunately this solution only works in bash, not in Windows cmd.






          share|improve this answer
























          • The alias won't work either in a bash script.

            – xenoid
            yesterday











          • Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

            – Qwerty
            20 hours ago






          • 1





            Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

            – xenoid
            18 hours ago











          • Right, then I will put it to ~/.bashrc file

            – Qwerty
            16 hours ago











          • won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

            – xenoid
            16 hours ago














          0












          0








          0







          I will just put it here



          $ alias whereget='_whereget() { A=$1; B=$2; shift 2; eval "$(where $B | head -$A | tail -1)" $@; }; _whereget'
          $ whereget 2 find . -type d


          Unfortunately this solution only works in bash, not in Windows cmd.






          share|improve this answer













          I will just put it here



          $ alias whereget='_whereget() { A=$1; B=$2; shift 2; eval "$(where $B | head -$A | tail -1)" $@; }; _whereget'
          $ whereget 2 find . -type d


          Unfortunately this solution only works in bash, not in Windows cmd.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          QwertyQwerty

          299313




          299313













          • The alias won't work either in a bash script.

            – xenoid
            yesterday











          • Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

            – Qwerty
            20 hours ago






          • 1





            Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

            – xenoid
            18 hours ago











          • Right, then I will put it to ~/.bashrc file

            – Qwerty
            16 hours ago











          • won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

            – xenoid
            16 hours ago



















          • The alias won't work either in a bash script.

            – xenoid
            yesterday











          • Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

            – Qwerty
            20 hours ago






          • 1





            Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

            – xenoid
            18 hours ago











          • Right, then I will put it to ~/.bashrc file

            – Qwerty
            16 hours ago











          • won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

            – xenoid
            16 hours ago

















          The alias won't work either in a bash script.

          – xenoid
          yesterday





          The alias won't work either in a bash script.

          – xenoid
          yesterday













          Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

          – Qwerty
          20 hours ago





          Interesting, it only works in the active console. Would you mind clarifying why? @xenoid

          – Qwerty
          20 hours ago




          1




          1





          Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

          – xenoid
          18 hours ago





          Because when you run a script, it's a new bash instance in which the alias is not defined (only properly exported environment variables are inherited from the parent). If your "source" the file, it is run in the same bash instance, and the alias is used. And I don't see a way to define the alias for a script, since on the interactive bash instances read the profile files (.bashrc and .bash_profile).

          – xenoid
          18 hours ago













          Right, then I will put it to ~/.bashrc file

          – Qwerty
          16 hours ago





          Right, then I will put it to ~/.bashrc file

          – Qwerty
          16 hours ago













          won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

          – xenoid
          16 hours ago





          won't work, because, as I said .bashrc is only used by interactive shells. It is not run by instances of bash that are started to run scripts. And you can't use functions for the same reason.

          – xenoid
          16 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1423785%2fhow-to-run-the-other-executable-matching-the-same-name-found-in-path%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...