Re: bash command completion has a problem with sudo command
From:
Chet Ramey
Subject:
Re: bash command completion has a problem with sudo command
Date:
Mon, 22 Aug 2022 15:48:51 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.1.2
On 8/22/22 2:10 AM, Hyunho Cho wrote:
Bash Version: 5.1
Patch Level: 16
Release Status: release
##############################################################
when command completion function start running there are three
variables automatically setting
bash$ hello foo ba[tab]
$1 (command): hello
$2 (current): ba
$3 (previous): foo
bash$ echo -n "$COMP_WORDBREAKS" | od -a
0000000 sp ht nl " ' @ > < = ; | & ( :
bash$ hello --opt foo:[tab] # ":" is a member of $COMP_WORDBREAKS
$1 (command): hello
$2 (current): (empty) # default behavior
$3 (previous): foo
bash$ sudo hello --opt foo:[tab] # using sudo command
$1 (command): hello
$2 (current): : <----- not empty
$3 (previous): foo
I can't reproduce this. When I test without bash-completion installed, I
get the same null second argument with or without specifying `sudo'.
--
``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/