Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: autocompletion

  1. #1

    Default autocompletion

    hi, i'm having some troubles enabling autocomplition for bash

    the problem i'm having is when using sudo or zypper

    any help is appreciated! (:

    ps: is there any irc for opensuse community?

  2. #2
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,733
    Blog Entries
    20

    Default Re: autocompletion

    Remember you have to be in the root dir of the file name, if that's what you were wanting to auto complete
    Leap 15.1_KDE
    My Articles Was I any help? If yes: Click the star below

  3. #3

    Default Re: autocompletion

    Quote Originally Posted by caf4926 View Post
    Remember you have to be in the root dir of the file name, if that's what you were wanting to auto complete
    oh, i see. but, say chmod for example

    i can see i can autocomplete by going sudo /bin/chmod

    but sudo chmod works, and when I write sudo ch it dosn't get autocompleted, could it be possible?

  4. #4
    palladium NNTP User

    Default Re: autocompletion

    bcurcio wrote:
    > ps: is there any irc for opensuse community?


    yep...we got most everything: IRC, mail list, web forum, nntp forum
    and more..

    get there from here: http://en.opensuse.org/Communicate

    --
    palladium

  5. #5

    Default Re: autocompletion

    Code:
    sudo ch
    chacl                            check-binary-files               chktrust
    chage                            checkbrack                       chmod
    chainsaw                         checkmedia                       chmorph
    change_permissions_for_cdrtools  checkproc                        chooser
    chat                             checkXML                         chown
    chattr                           chessx                           chpasswd
    chcon                            chfn                             chroot
    chdist                           chgrp                            chrp-addnote
    cheatmake                        chkconfig                        chrt
    checkagents                      chkstat                          chsh
    checkbashisms                    chkstat-polkit                   chvt
    Obviously, yes.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,142

    Default Re: autocompletion

    Quote Originally Posted by bcurcio View Post
    oh, i see. but, say chmod for example

    i can see i can autocomplete by going sudo /bin/chmod

    but sudo chmod works, and when I write sudo ch it dosn't get autocompleted, could it be possible?
    The shell tries autocompletion for the first word in a command line supposing it is a the name of an executable that can be found with your PATH environment variable.

    The shell tries autocompletion for all the other fields in the command line with the filenames found in eithter the working directory, or when allready directories are given in a filename found in that path. This was designed because most often the other fields (and specialy when a user wants to use autocompletion) is much more likely to b a file then a command.

    The shell does not know that in the case of the sudo executable one of the fields following it can be an executable itself. Thus it tries to autocomplete, but with the names of the files in your working directory.

    In other words, when you try to autocomplete
    Code:
    sud
    it seraches for executabls inside the directories mentioned in your PATH.
    When
    Code:
    sudo /bin/chm
    it searched for a file (not an executabl!) insid /bin
    When
    Code:
    sudo chm
    it searches for a file inside the current working directory (where you most probably do not have a file with the name chmod I suppose, but do a cd /bin first and it will find chmod).

    @Akoellh
    can not reproduce that here.
    Henk van Velden

  7. #7

    Default Re: autocompletion

    Quote Originally Posted by hcvv View Post
    @Akoellh
    can not reproduce that here.
    You did press TAB twice, did you?

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,142

    Default Re: autocompletion

    Quote Originally Posted by Akoellh View Post
    You did press TAB twice, did you?
    Even thrice and more. It works with sud\t\t, but not with sud ch\t\t.
    Henk van Velden

  9. #9

    Default Re: autocompletion

    Well, I think I might know the reason why.

    But have a look at this ...

    Code:
    zypper in
    info                    install                 installed               install-new-recommends
    and I am sure this will work on your system, too but maybe this will not work

    Code:
     rpm -q bas
    bash             bash-completion  bash-doc
    (And the last command is a very big hint :-))

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,142

    Default Re: autocompletion

    Exactly as you thought:

    The first autocompleted, the second did not and indeed bash-completion is not installed.

    What is in bash-completetion? More knowledge about the fields of several much used commands? When yes, would it help the OP to install this?
    Henk van Velden

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •