[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Capture tab in a readline.
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] Capture tab in a readline. |
Date: |
Mon, 21 Aug 2017 15:44:52 +0300 |
On Mon, Aug 21, 2017 at 2:41 PM, Sinbad <address@hidden> wrote:
> Hi,
>
> I'm trying to capture tab with readline. The following is not working as
> expected.
> I don't want to use "-n 1", as i need the command editing capability. Any
> advice ?
>
>
> while IFS= read -e -i "$cmd" -p $prompt char
> do
> if [[ "$char" == "$mytab" ]]; then
> echo "got tab"
> fi
> done
>
It's not really clear what you intend to do exactly. But here is a couple
of pointer:
1) If you don't use -n 1 then you will read a whole line. So you will need
to type exactly one tab and press enter.
2) since you use -i "$cmd" you need to make sure you delete whatever is put
by default
3) since you use -e, pressing tab will not insert a "TAB" character,
instead it will try to complete, to be able to input a tab
you will need to press "control-v" then a TAB
Having said that, are you trying to implement completion?