Display options for command at the prompt

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











up vote
0
down vote

favorite












Is there a way to script any Linux commands to prompt the user for input?



For example:



chage has many options



Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS


I like to type in chage and get the above option and allow me to select one. This will help me to remember all the options rather than having to type chage -h every time.










share|improve this question



























    up vote
    0
    down vote

    favorite












    Is there a way to script any Linux commands to prompt the user for input?



    For example:



    chage has many options



    Options:
    -d, --lastday LAST_DAY set date of last password change to LAST_DAY
    -E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
    -h, --help display this help message and exit
    -I, --inactive INACTIVE set password inactive after expiration
    to INACTIVE
    -l, --list show account aging information
    -m, --mindays MIN_DAYS set minimum number of days before password
    change to MIN_DAYS
    -M, --maxdays MAX_DAYS set maximim number of days before password
    change to MAX_DAYS
    -R, --root CHROOT_DIR directory to chroot into
    -W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS


    I like to type in chage and get the above option and allow me to select one. This will help me to remember all the options rather than having to type chage -h every time.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Is there a way to script any Linux commands to prompt the user for input?



      For example:



      chage has many options



      Options:
      -d, --lastday LAST_DAY set date of last password change to LAST_DAY
      -E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
      -h, --help display this help message and exit
      -I, --inactive INACTIVE set password inactive after expiration
      to INACTIVE
      -l, --list show account aging information
      -m, --mindays MIN_DAYS set minimum number of days before password
      change to MIN_DAYS
      -M, --maxdays MAX_DAYS set maximim number of days before password
      change to MAX_DAYS
      -R, --root CHROOT_DIR directory to chroot into
      -W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS


      I like to type in chage and get the above option and allow me to select one. This will help me to remember all the options rather than having to type chage -h every time.










      share|improve this question















      Is there a way to script any Linux commands to prompt the user for input?



      For example:



      chage has many options



      Options:
      -d, --lastday LAST_DAY set date of last password change to LAST_DAY
      -E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
      -h, --help display this help message and exit
      -I, --inactive INACTIVE set password inactive after expiration
      to INACTIVE
      -l, --list show account aging information
      -m, --mindays MIN_DAYS set minimum number of days before password
      change to MIN_DAYS
      -M, --maxdays MAX_DAYS set maximim number of days before password
      change to MAX_DAYS
      -R, --root CHROOT_DIR directory to chroot into
      -W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS


      I like to type in chage and get the above option and allow me to select one. This will help me to remember all the options rather than having to type chage -h every time.







      linux command-line options






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 8 at 19:11









      jasonwryan

      47.1k14127178




      47.1k14127178










      asked Aug 8 at 18:10









      Reza

      1




      1




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          Is there a way to script a specific command? Yes. Is there a way to generalize that to all commands? Not that I'm aware of.



          That said, something that might help is bash-completion. With that, you can type the command and a - followed by a double tab and see the list of options available.



          $ chage --<tab><tab>
          --expiredate --inactive --list --mindays --warndays
          --help --lastday --maxdays --root

          $ chage <tab><tab>
          <list of user names>





          share|improve this answer



























            up vote
            0
            down vote













            Zsh has the run-help widget, by default bound to ESCh, that will invoke the respective man page for the command at the prompt; eg.,



            chageESCh



            will open CHAGE(1).



            quitting out of the man page will leave you back at the command prompt, ready to enter your options.



            The widget is described in detail in man zshcontrib:




            Accessing On-Line Help

            The key sequence ESC h is normally bound by ZLE to execute the run-help widget (see zshzle(1)). This invokes the run-help command
            with the command word from the current input line as its argument. By default, run-help is an alias for the man command, so this often fails when the command word is a shell builtin or a user-defined function. By redefining the run-help alias, one can improve the on-line help provided by the
            shell.




            As the man page notes, this widget is configurable to point to your own helpfiles (defined by HELPDIR), or others provided by the community.






            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%2f461332%2fdisplay-options-for-command-at-the-prompt%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              Is there a way to script a specific command? Yes. Is there a way to generalize that to all commands? Not that I'm aware of.



              That said, something that might help is bash-completion. With that, you can type the command and a - followed by a double tab and see the list of options available.



              $ chage --<tab><tab>
              --expiredate --inactive --list --mindays --warndays
              --help --lastday --maxdays --root

              $ chage <tab><tab>
              <list of user names>





              share|improve this answer
























                up vote
                2
                down vote













                Is there a way to script a specific command? Yes. Is there a way to generalize that to all commands? Not that I'm aware of.



                That said, something that might help is bash-completion. With that, you can type the command and a - followed by a double tab and see the list of options available.



                $ chage --<tab><tab>
                --expiredate --inactive --list --mindays --warndays
                --help --lastday --maxdays --root

                $ chage <tab><tab>
                <list of user names>





                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  Is there a way to script a specific command? Yes. Is there a way to generalize that to all commands? Not that I'm aware of.



                  That said, something that might help is bash-completion. With that, you can type the command and a - followed by a double tab and see the list of options available.



                  $ chage --<tab><tab>
                  --expiredate --inactive --list --mindays --warndays
                  --help --lastday --maxdays --root

                  $ chage <tab><tab>
                  <list of user names>





                  share|improve this answer












                  Is there a way to script a specific command? Yes. Is there a way to generalize that to all commands? Not that I'm aware of.



                  That said, something that might help is bash-completion. With that, you can type the command and a - followed by a double tab and see the list of options available.



                  $ chage --<tab><tab>
                  --expiredate --inactive --list --mindays --warndays
                  --help --lastday --maxdays --root

                  $ chage <tab><tab>
                  <list of user names>






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 8 at 18:17









                  Andy Dalton

                  4,8091520




                  4,8091520






















                      up vote
                      0
                      down vote













                      Zsh has the run-help widget, by default bound to ESCh, that will invoke the respective man page for the command at the prompt; eg.,



                      chageESCh



                      will open CHAGE(1).



                      quitting out of the man page will leave you back at the command prompt, ready to enter your options.



                      The widget is described in detail in man zshcontrib:




                      Accessing On-Line Help

                      The key sequence ESC h is normally bound by ZLE to execute the run-help widget (see zshzle(1)). This invokes the run-help command
                      with the command word from the current input line as its argument. By default, run-help is an alias for the man command, so this often fails when the command word is a shell builtin or a user-defined function. By redefining the run-help alias, one can improve the on-line help provided by the
                      shell.




                      As the man page notes, this widget is configurable to point to your own helpfiles (defined by HELPDIR), or others provided by the community.






                      share|improve this answer
























                        up vote
                        0
                        down vote













                        Zsh has the run-help widget, by default bound to ESCh, that will invoke the respective man page for the command at the prompt; eg.,



                        chageESCh



                        will open CHAGE(1).



                        quitting out of the man page will leave you back at the command prompt, ready to enter your options.



                        The widget is described in detail in man zshcontrib:




                        Accessing On-Line Help

                        The key sequence ESC h is normally bound by ZLE to execute the run-help widget (see zshzle(1)). This invokes the run-help command
                        with the command word from the current input line as its argument. By default, run-help is an alias for the man command, so this often fails when the command word is a shell builtin or a user-defined function. By redefining the run-help alias, one can improve the on-line help provided by the
                        shell.




                        As the man page notes, this widget is configurable to point to your own helpfiles (defined by HELPDIR), or others provided by the community.






                        share|improve this answer






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          Zsh has the run-help widget, by default bound to ESCh, that will invoke the respective man page for the command at the prompt; eg.,



                          chageESCh



                          will open CHAGE(1).



                          quitting out of the man page will leave you back at the command prompt, ready to enter your options.



                          The widget is described in detail in man zshcontrib:




                          Accessing On-Line Help

                          The key sequence ESC h is normally bound by ZLE to execute the run-help widget (see zshzle(1)). This invokes the run-help command
                          with the command word from the current input line as its argument. By default, run-help is an alias for the man command, so this often fails when the command word is a shell builtin or a user-defined function. By redefining the run-help alias, one can improve the on-line help provided by the
                          shell.




                          As the man page notes, this widget is configurable to point to your own helpfiles (defined by HELPDIR), or others provided by the community.






                          share|improve this answer












                          Zsh has the run-help widget, by default bound to ESCh, that will invoke the respective man page for the command at the prompt; eg.,



                          chageESCh



                          will open CHAGE(1).



                          quitting out of the man page will leave you back at the command prompt, ready to enter your options.



                          The widget is described in detail in man zshcontrib:




                          Accessing On-Line Help

                          The key sequence ESC h is normally bound by ZLE to execute the run-help widget (see zshzle(1)). This invokes the run-help command
                          with the command word from the current input line as its argument. By default, run-help is an alias for the man command, so this often fails when the command word is a shell builtin or a user-defined function. By redefining the run-help alias, one can improve the on-line help provided by the
                          shell.




                          As the man page notes, this widget is configurable to point to your own helpfiles (defined by HELPDIR), or others provided by the community.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 8 at 18:50









                          jasonwryan

                          47.1k14127178




                          47.1k14127178



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461332%2fdisplay-options-for-command-at-the-prompt%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Popular posts from this blog

                              Peggy Mitchell

                              The Forum (Inglewood, California)

                              Palaiologos