mainThe GNU Bourne-Again SHell - Support: sr #109653, compgen -c echoes directory names...


sr #109653: compgen -c echoes directory names supplied to it

Submitter:  None
Submitted:  Tue 05 Mar 2019 07:57:11 PM UTC
Category:  None Priority:  5 - Normal
Severity:  2 - Minor Status:  Works For Me
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Thu 21 Mar 2019 03:23:33 PM UTC, comment #2: 

Okay, that makes sense. Thanks!

Ben Mundt <bmundt6>
Wed 20 Mar 2019 07:45:21 PM UTC, comment #1: 

It returns the same values that completion on a command word (a word that is potentially the first word of a simple command) would. That returns directories as partial matches so you can build a full pathname to a command iteratively.

Chet Ramey <chet>
Group administrator
Tue 05 Mar 2019 07:57:11 PM UTC, original submission:  

The following experiment results in an unexpected behavior:

compgen -c this  # prints nothing
mkdir this_is_not_a_command
compgen -c this  # still nothing
compgen -c this_is_not_a_command  # prints "this_is_not_a_command"

I can't find any documentation saying that a directory name should be considered a valid command name for completions; my assumption was that the output of 'compgen -c' should consist only of names for which 'type -t $name' returns a non-empty string.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bmundt6 (Posted a comment)
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-20 chet StatusNone Works For Me

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code