Why does gnu which show a script instead of a file path

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











up vote
0
down vote

favorite












I encounterd the following output while using which



[user@localhost ~]$ which gem
gem ()



I have seen which show aliases but not bash scripts before.



This script obviously came from RVM but how did it get in to which and where can I find it on my filesystem? It isn't in .bashrc.







share|improve this question




















  • Related: unix.stackexchange.com/a/85250/117549 -- quoting: "There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer (and I believe some Linux distributions set some global aliases around that for bash to do that)."
    – Jeff Schaller
    Jan 31 at 1:20











  • See also: unix.stackexchange.com/q/322817/117549
    – Jeff Schaller
    Jan 31 at 1:21






  • 3




    that's not a script, it's a shell function.
    – cas
    Jan 31 at 5:04














up vote
0
down vote

favorite












I encounterd the following output while using which



[user@localhost ~]$ which gem
gem ()



I have seen which show aliases but not bash scripts before.



This script obviously came from RVM but how did it get in to which and where can I find it on my filesystem? It isn't in .bashrc.







share|improve this question




















  • Related: unix.stackexchange.com/a/85250/117549 -- quoting: "There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer (and I believe some Linux distributions set some global aliases around that for bash to do that)."
    – Jeff Schaller
    Jan 31 at 1:20











  • See also: unix.stackexchange.com/q/322817/117549
    – Jeff Schaller
    Jan 31 at 1:21






  • 3




    that's not a script, it's a shell function.
    – cas
    Jan 31 at 5:04












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I encounterd the following output while using which



[user@localhost ~]$ which gem
gem ()



I have seen which show aliases but not bash scripts before.



This script obviously came from RVM but how did it get in to which and where can I find it on my filesystem? It isn't in .bashrc.







share|improve this question












I encounterd the following output while using which



[user@localhost ~]$ which gem
gem ()



I have seen which show aliases but not bash scripts before.



This script obviously came from RVM but how did it get in to which and where can I find it on my filesystem? It isn't in .bashrc.









share|improve this question











share|improve this question




share|improve this question










asked Jan 31 at 0:34









Qwertie

241210




241210











  • Related: unix.stackexchange.com/a/85250/117549 -- quoting: "There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer (and I believe some Linux distributions set some global aliases around that for bash to do that)."
    – Jeff Schaller
    Jan 31 at 1:20











  • See also: unix.stackexchange.com/q/322817/117549
    – Jeff Schaller
    Jan 31 at 1:21






  • 3




    that's not a script, it's a shell function.
    – cas
    Jan 31 at 5:04
















  • Related: unix.stackexchange.com/a/85250/117549 -- quoting: "There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer (and I believe some Linux distributions set some global aliases around that for bash to do that)."
    – Jeff Schaller
    Jan 31 at 1:20











  • See also: unix.stackexchange.com/q/322817/117549
    – Jeff Schaller
    Jan 31 at 1:21






  • 3




    that's not a script, it's a shell function.
    – cas
    Jan 31 at 5:04















Related: unix.stackexchange.com/a/85250/117549 -- quoting: "There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer (and I believe some Linux distributions set some global aliases around that for bash to do that)."
– Jeff Schaller
Jan 31 at 1:20





Related: unix.stackexchange.com/a/85250/117549 -- quoting: "There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer (and I believe some Linux distributions set some global aliases around that for bash to do that)."
– Jeff Schaller
Jan 31 at 1:20













See also: unix.stackexchange.com/q/322817/117549
– Jeff Schaller
Jan 31 at 1:21




See also: unix.stackexchange.com/q/322817/117549
– Jeff Schaller
Jan 31 at 1:21




3




3




that's not a script, it's a shell function.
– cas
Jan 31 at 5:04




that's not a script, it's a shell function.
– cas
Jan 31 at 5:04










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Try this:



shopt -s extdebug
declare -F gem


From man builtins:



extdebug
If set, behavior intended for use by debuggers is enabled:
1. The -F option to the declare builtin displays the source file
name and line number corresponding to each function name sup‐
plied as an argument.





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f420832%2fwhy-does-gnu-which-show-a-script-instead-of-a-file-path%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Try this:



    shopt -s extdebug
    declare -F gem


    From man builtins:



    extdebug
    If set, behavior intended for use by debuggers is enabled:
    1. The -F option to the declare builtin displays the source file
    name and line number corresponding to each function name sup‐
    plied as an argument.





    share|improve this answer
























      up vote
      0
      down vote













      Try this:



      shopt -s extdebug
      declare -F gem


      From man builtins:



      extdebug
      If set, behavior intended for use by debuggers is enabled:
      1. The -F option to the declare builtin displays the source file
      name and line number corresponding to each function name sup‐
      plied as an argument.





      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Try this:



        shopt -s extdebug
        declare -F gem


        From man builtins:



        extdebug
        If set, behavior intended for use by debuggers is enabled:
        1. The -F option to the declare builtin displays the source file
        name and line number corresponding to each function name sup‐
        plied as an argument.





        share|improve this answer












        Try this:



        shopt -s extdebug
        declare -F gem


        From man builtins:



        extdebug
        If set, behavior intended for use by debuggers is enabled:
        1. The -F option to the declare builtin displays the source file
        name and line number corresponding to each function name sup‐
        plied as an argument.






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 2 at 0:07









        m0dular

        63115




        63115






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420832%2fwhy-does-gnu-which-show-a-script-instead-of-a-file-path%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

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

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?