help-bash
[Top][All Lists]
Advanced

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

Re: Modifying completion of read(1builtin)


From: Chet Ramey
Subject: Re: Modifying completion of read(1builtin)
Date: Wed, 29 Mar 2023 10:43:20 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 3/28/23 3:42 PM, Douglas Lewan wrote:
Hi, all,

I have a list of about 30 strings that are appropriate for a certain instance of read(1builtin).

How can I set up completion for read to include them? It looks like some combination of compgen() and complete() would be right, but I haven't been able to find it. Can anyone help?

This is what the -W option to `complete' can do.

complete -W "words" read

It also looks like any such modification would apply to all instances of read. Can it be restricted to that one instance? Can it be restricted to exactly those values?

The usual way to do this is to save and restore any completion for `read',
using `complete -p', a temporary file, and `.'. There isn't any builtin way
to temporarily modify completion specifications.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]