What does running “builtin” do? [duplicate]











up vote
1
down vote

favorite













This question already has an answer here:




  • How do I get help for “echo” or other bash commands?

    4 answers




Simple question, really...



Builtin?



What happens when you run: builtin?



The return type from echo $? is 0.



Which means that the command has most likely run successfully.



So, what does running builtin accomplish?










share|improve this question













marked as duplicate by pzkpfw, George Udosen, Marcel Stimberg, wjandrea, N0rbert Nov 20 at 19:57


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.















  • How can I get help on terminal commands?
    – dessert
    Nov 19 at 21:17















up vote
1
down vote

favorite













This question already has an answer here:




  • How do I get help for “echo” or other bash commands?

    4 answers




Simple question, really...



Builtin?



What happens when you run: builtin?



The return type from echo $? is 0.



Which means that the command has most likely run successfully.



So, what does running builtin accomplish?










share|improve this question













marked as duplicate by pzkpfw, George Udosen, Marcel Stimberg, wjandrea, N0rbert Nov 20 at 19:57


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.















  • How can I get help on terminal commands?
    – dessert
    Nov 19 at 21:17













up vote
1
down vote

favorite









up vote
1
down vote

favorite












This question already has an answer here:




  • How do I get help for “echo” or other bash commands?

    4 answers




Simple question, really...



Builtin?



What happens when you run: builtin?



The return type from echo $? is 0.



Which means that the command has most likely run successfully.



So, what does running builtin accomplish?










share|improve this question














This question already has an answer here:




  • How do I get help for “echo” or other bash commands?

    4 answers




Simple question, really...



Builtin?



What happens when you run: builtin?



The return type from echo $? is 0.



Which means that the command has most likely run successfully.



So, what does running builtin accomplish?





This question already has an answer here:




  • How do I get help for “echo” or other bash commands?

    4 answers








bash






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 21:10









NerdOfCode

1,062323




1,062323




marked as duplicate by pzkpfw, George Udosen, Marcel Stimberg, wjandrea, N0rbert Nov 20 at 19:57


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 pzkpfw, George Udosen, Marcel Stimberg, wjandrea, N0rbert Nov 20 at 19:57


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.














  • How can I get help on terminal commands?
    – dessert
    Nov 19 at 21:17


















  • How can I get help on terminal commands?
    – dessert
    Nov 19 at 21:17
















How can I get help on terminal commands?
– dessert
Nov 19 at 21:17




How can I get help on terminal commands?
– dessert
Nov 19 at 21:17










2 Answers
2






active

oldest

votes

















up vote
5
down vote



accepted










This is useful when you wish to reimplement a shell builtin
as a shell function, but need to execute the builtin within the function.



$ type echo
echo is a shell builtin

$ function echo(){ builtin echo "'$1'"; }

$ echo hi
'hi'




help builtin 



builtin: builtin [shell-builtin [arg ...]]
Execute shell builtins.



Execute SHELL-BUILTIN with arguments ARGs without performing command
lookup. This is useful when you wish to reimplement a shell builtin
as a shell function, but need to execute the builtin within the function.

Exit Status:
Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
not a shell builtin.






share|improve this answer






























    up vote
    2
    down vote













    From help -m builtin:




    NAME
    builtin - Execute shell builtins.

    SYNOPSIS
    builtin [shell-builtin [arg ...]]

    DESCRIPTION
    Execute shell builtins.

    Execute SHELL-BUILTIN with arguments ARGs without performing command
    lookup. This is useful when you wish to reimplement a shell builtin
    as a shell function, but need to execute the builtin within the function.


    Example usage:



    cd (){
    builtin cd "$@"
    pwd
    }


    This cd's, then prints the new working directory (like in IPython). If you forget the builtin part, it will keep calling itself in an infinite loop.






    share|improve this answer






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      5
      down vote



      accepted










      This is useful when you wish to reimplement a shell builtin
      as a shell function, but need to execute the builtin within the function.



      $ type echo
      echo is a shell builtin

      $ function echo(){ builtin echo "'$1'"; }

      $ echo hi
      'hi'




      help builtin 



      builtin: builtin [shell-builtin [arg ...]]
      Execute shell builtins.



      Execute SHELL-BUILTIN with arguments ARGs without performing command
      lookup. This is useful when you wish to reimplement a shell builtin
      as a shell function, but need to execute the builtin within the function.

      Exit Status:
      Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
      not a shell builtin.






      share|improve this answer



























        up vote
        5
        down vote



        accepted










        This is useful when you wish to reimplement a shell builtin
        as a shell function, but need to execute the builtin within the function.



        $ type echo
        echo is a shell builtin

        $ function echo(){ builtin echo "'$1'"; }

        $ echo hi
        'hi'




        help builtin 



        builtin: builtin [shell-builtin [arg ...]]
        Execute shell builtins.



        Execute SHELL-BUILTIN with arguments ARGs without performing command
        lookup. This is useful when you wish to reimplement a shell builtin
        as a shell function, but need to execute the builtin within the function.

        Exit Status:
        Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
        not a shell builtin.






        share|improve this answer

























          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          This is useful when you wish to reimplement a shell builtin
          as a shell function, but need to execute the builtin within the function.



          $ type echo
          echo is a shell builtin

          $ function echo(){ builtin echo "'$1'"; }

          $ echo hi
          'hi'




          help builtin 



          builtin: builtin [shell-builtin [arg ...]]
          Execute shell builtins.



          Execute SHELL-BUILTIN with arguments ARGs without performing command
          lookup. This is useful when you wish to reimplement a shell builtin
          as a shell function, but need to execute the builtin within the function.

          Exit Status:
          Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
          not a shell builtin.






          share|improve this answer














          This is useful when you wish to reimplement a shell builtin
          as a shell function, but need to execute the builtin within the function.



          $ type echo
          echo is a shell builtin

          $ function echo(){ builtin echo "'$1'"; }

          $ echo hi
          'hi'




          help builtin 



          builtin: builtin [shell-builtin [arg ...]]
          Execute shell builtins.



          Execute SHELL-BUILTIN with arguments ARGs without performing command
          lookup. This is useful when you wish to reimplement a shell builtin
          as a shell function, but need to execute the builtin within the function.

          Exit Status:
          Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
          not a shell builtin.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 19 at 21:18

























          answered Nov 19 at 21:14









          Ravexina

          30.6k1478106




          30.6k1478106
























              up vote
              2
              down vote













              From help -m builtin:




              NAME
              builtin - Execute shell builtins.

              SYNOPSIS
              builtin [shell-builtin [arg ...]]

              DESCRIPTION
              Execute shell builtins.

              Execute SHELL-BUILTIN with arguments ARGs without performing command
              lookup. This is useful when you wish to reimplement a shell builtin
              as a shell function, but need to execute the builtin within the function.


              Example usage:



              cd (){
              builtin cd "$@"
              pwd
              }


              This cd's, then prints the new working directory (like in IPython). If you forget the builtin part, it will keep calling itself in an infinite loop.






              share|improve this answer



























                up vote
                2
                down vote













                From help -m builtin:




                NAME
                builtin - Execute shell builtins.

                SYNOPSIS
                builtin [shell-builtin [arg ...]]

                DESCRIPTION
                Execute shell builtins.

                Execute SHELL-BUILTIN with arguments ARGs without performing command
                lookup. This is useful when you wish to reimplement a shell builtin
                as a shell function, but need to execute the builtin within the function.


                Example usage:



                cd (){
                builtin cd "$@"
                pwd
                }


                This cd's, then prints the new working directory (like in IPython). If you forget the builtin part, it will keep calling itself in an infinite loop.






                share|improve this answer

























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  From help -m builtin:




                  NAME
                  builtin - Execute shell builtins.

                  SYNOPSIS
                  builtin [shell-builtin [arg ...]]

                  DESCRIPTION
                  Execute shell builtins.

                  Execute SHELL-BUILTIN with arguments ARGs without performing command
                  lookup. This is useful when you wish to reimplement a shell builtin
                  as a shell function, but need to execute the builtin within the function.


                  Example usage:



                  cd (){
                  builtin cd "$@"
                  pwd
                  }


                  This cd's, then prints the new working directory (like in IPython). If you forget the builtin part, it will keep calling itself in an infinite loop.






                  share|improve this answer














                  From help -m builtin:




                  NAME
                  builtin - Execute shell builtins.

                  SYNOPSIS
                  builtin [shell-builtin [arg ...]]

                  DESCRIPTION
                  Execute shell builtins.

                  Execute SHELL-BUILTIN with arguments ARGs without performing command
                  lookup. This is useful when you wish to reimplement a shell builtin
                  as a shell function, but need to execute the builtin within the function.


                  Example usage:



                  cd (){
                  builtin cd "$@"
                  pwd
                  }


                  This cd's, then prints the new working directory (like in IPython). If you forget the builtin part, it will keep calling itself in an infinite loop.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 20 at 20:04

























                  answered Nov 19 at 21:14









                  wjandrea

                  7,92742258




                  7,92742258















                      Popular posts from this blog

                      How to change which sound is reproduced for terminal bell?

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents