Bash like installation suggestion in tcsh

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








up vote
0
down vote

favorite












In a bash shell, if you put some command that is not installed on your system, it throws an error and also gives you a package installation suggestion. For example-



$ iostat

Command 'iostat' not found, but can be installed with:

sudo apt install sysstat


My personal favorite is tcsh but it does not give any package installation suggestion while some command is not found. How can I get the package installation suggestion (like bash) in tcsh?







share|improve this question
























    up vote
    0
    down vote

    favorite












    In a bash shell, if you put some command that is not installed on your system, it throws an error and also gives you a package installation suggestion. For example-



    $ iostat

    Command 'iostat' not found, but can be installed with:

    sudo apt install sysstat


    My personal favorite is tcsh but it does not give any package installation suggestion while some command is not found. How can I get the package installation suggestion (like bash) in tcsh?







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      In a bash shell, if you put some command that is not installed on your system, it throws an error and also gives you a package installation suggestion. For example-



      $ iostat

      Command 'iostat' not found, but can be installed with:

      sudo apt install sysstat


      My personal favorite is tcsh but it does not give any package installation suggestion while some command is not found. How can I get the package installation suggestion (like bash) in tcsh?







      share|improve this question












      In a bash shell, if you put some command that is not installed on your system, it throws an error and also gives you a package installation suggestion. For example-



      $ iostat

      Command 'iostat' not found, but can be installed with:

      sudo apt install sysstat


      My personal favorite is tcsh but it does not give any package installation suggestion while some command is not found. How can I get the package installation suggestion (like bash) in tcsh?









      share|improve this question











      share|improve this question




      share|improve this question










      asked May 15 at 13:22









      sabquat

      285




      285




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The magic works because of command_not_found package that provide a command_not_found_handle function for both bash and zsh.



          This works in bash because of this snippet in /etc/bash.bashrc



          # if the command-not-found package is installed, use it
          if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
          function command_not_found_handle
          # check because c-n-f could've been removed in the meantime
          if [ -x /usr/lib/command-not-found ]; then
          /usr/lib/command-not-found -- "$1"
          return $?
          elif [ -x /usr/share/command-not-found/command-not-found ]; then
          /usr/share/command-not-found/command-not-found -- "$1"
          return $?
          else
          printf "%s: command not foundn" "$1" >&2
          return 127
          fi

          fi


          There is also a file /etc/zsh_command_not_found that you can source to get that behavior for zsh - here, the function is called command_not_found_handler.



          From a quick search, it does not seem that tcsh include such a functionnality to define a command_not_found_handle. So may be the name, is different, in that case you just need to convert the snippet in tcsh and include it in your ~/.tcshrc, else you can't!






          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%2f1036531%2fbash-like-installation-suggestion-in-tcsh%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













            The magic works because of command_not_found package that provide a command_not_found_handle function for both bash and zsh.



            This works in bash because of this snippet in /etc/bash.bashrc



            # if the command-not-found package is installed, use it
            if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
            function command_not_found_handle
            # check because c-n-f could've been removed in the meantime
            if [ -x /usr/lib/command-not-found ]; then
            /usr/lib/command-not-found -- "$1"
            return $?
            elif [ -x /usr/share/command-not-found/command-not-found ]; then
            /usr/share/command-not-found/command-not-found -- "$1"
            return $?
            else
            printf "%s: command not foundn" "$1" >&2
            return 127
            fi

            fi


            There is also a file /etc/zsh_command_not_found that you can source to get that behavior for zsh - here, the function is called command_not_found_handler.



            From a quick search, it does not seem that tcsh include such a functionnality to define a command_not_found_handle. So may be the name, is different, in that case you just need to convert the snippet in tcsh and include it in your ~/.tcshrc, else you can't!






            share|improve this answer


























              up vote
              0
              down vote













              The magic works because of command_not_found package that provide a command_not_found_handle function for both bash and zsh.



              This works in bash because of this snippet in /etc/bash.bashrc



              # if the command-not-found package is installed, use it
              if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
              function command_not_found_handle
              # check because c-n-f could've been removed in the meantime
              if [ -x /usr/lib/command-not-found ]; then
              /usr/lib/command-not-found -- "$1"
              return $?
              elif [ -x /usr/share/command-not-found/command-not-found ]; then
              /usr/share/command-not-found/command-not-found -- "$1"
              return $?
              else
              printf "%s: command not foundn" "$1" >&2
              return 127
              fi

              fi


              There is also a file /etc/zsh_command_not_found that you can source to get that behavior for zsh - here, the function is called command_not_found_handler.



              From a quick search, it does not seem that tcsh include such a functionnality to define a command_not_found_handle. So may be the name, is different, in that case you just need to convert the snippet in tcsh and include it in your ~/.tcshrc, else you can't!






              share|improve this answer
























                up vote
                0
                down vote










                up vote
                0
                down vote









                The magic works because of command_not_found package that provide a command_not_found_handle function for both bash and zsh.



                This works in bash because of this snippet in /etc/bash.bashrc



                # if the command-not-found package is installed, use it
                if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
                function command_not_found_handle
                # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
                /usr/lib/command-not-found -- "$1"
                return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
                /usr/share/command-not-found/command-not-found -- "$1"
                return $?
                else
                printf "%s: command not foundn" "$1" >&2
                return 127
                fi

                fi


                There is also a file /etc/zsh_command_not_found that you can source to get that behavior for zsh - here, the function is called command_not_found_handler.



                From a quick search, it does not seem that tcsh include such a functionnality to define a command_not_found_handle. So may be the name, is different, in that case you just need to convert the snippet in tcsh and include it in your ~/.tcshrc, else you can't!






                share|improve this answer














                The magic works because of command_not_found package that provide a command_not_found_handle function for both bash and zsh.



                This works in bash because of this snippet in /etc/bash.bashrc



                # if the command-not-found package is installed, use it
                if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
                function command_not_found_handle
                # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
                /usr/lib/command-not-found -- "$1"
                return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
                /usr/share/command-not-found/command-not-found -- "$1"
                return $?
                else
                printf "%s: command not foundn" "$1" >&2
                return 127
                fi

                fi


                There is also a file /etc/zsh_command_not_found that you can source to get that behavior for zsh - here, the function is called command_not_found_handler.



                From a quick search, it does not seem that tcsh include such a functionnality to define a command_not_found_handle. So may be the name, is different, in that case you just need to convert the snippet in tcsh and include it in your ~/.tcshrc, else you can't!







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 15 at 14:02

























                answered May 15 at 13:50









                solsTiCe

                4,87721642




                4,87721642






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036531%2fbash-like-installation-suggestion-in-tcsh%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Which professions warranted travel in Medieval times?

                    How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

                    Trouble downloading packages list due to a “Hash sum mismatch” error