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

 
 

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

Submitted by:  None
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    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.5