NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/40640: /bin/sh tab completion doesn't handle commands



>Number:         40640
>Category:       bin
>Synopsis:       /bin/sh tab completion doesn't handle commands
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 14 10:00:00 +0000 2009
>Originator:     Alan Barrett
>Release:        NetBSD 5.99.7
>Organization:
Not much
>Environment:
System: NetBSD 5.99.7  i386
>Description:
        Tab completion in /bin/sh can be enabled with "set -o tabcomplete".

        In most shells, tab completion is syntax sensitive, at least to the
        extent that it offers different completions for commands and
        non-commands.  In /bin/sh, tab completion always attempts to
        complete a file name.

>How-To-Repeat:
        For example, in ksh:

                ksh$ set -o emacs
                ksh$ cd /tmp ; touch pw1 pw2 pw3
                # type "pw" then press TAB
                ksh$ pw[TAB]
                # ksh displays some command names starting with "pw"
                pwd       pwd_mkdb  pwhash    pwhich
                ksh$ pw

        but in /bin/sh, the tab completion is much less useful:

                sh$ set -o emacs ; set -o tabcomplete
                sh$ cd /tmp ; touch pw1 pw2 pw3
                # type "pw" then press TAB
                sh$ pw[TAB]
                # sh attempts to treat "pw" as the start of a file name,
                # not as the start of a command name.  It changes the
                # "pw" to "./pw".  Press TAB again. and ./pw is expanded
                # to a list of file names:
                sh$ ./pw[TAB]
                ./pw1  ./pw2  ./pw3
                sh$ ./pw

>Fix:
        Make tab completion work with command names, not file names,
        for the first word on a line, the first word after ';', '|',
        '||', '&&', and any other contexts where it's known that
        the word must be a command.



Home | Main Index | Thread Index | Old Index