Re: RFE: remove duplicate entries from the result of `compgen -W'

2014-09-07 Thread Chet Ramey
On 9/4/14, 10:33 PM, Clark Wang wrote:
> See following example:
> 
>   $ echo $BASH_VERSION
>   4.3.18(1)-release
>   $ compgen -W 'hello hello' h
>   hello
>   hello
>   $
> 
> It'll be good if only one "hello" is outputted.

`complete' and `compgen' only generate lists of possible completions.
Readline performs duplicate removal when it is deciding what to do
with that list.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Why do associative arrays have a space before the closing )?

2014-09-07 Thread Chet Ramey
On 9/5/14, 5:30 PM, lolilolicon wrote:
> In the `declare -p` output, I mean:
> 
> % bash -c 'declare -A x; x=([foo]=bar [x]=y); declare -p x;'
> declare -A x='([foo]="bar" [x]="y" )'
> 
> Does it serve any purpose? Just curious.
> 

It's an artifact of how the code is written.  There's no special
meaning.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: ^L doesn't clear screen

2014-09-07 Thread Chet Ramey
On 9/6/14, 8:24 PM, ch...@cfajohnson.com wrote:

> Bash Version: 4.3
> Patch Level: 24
> Release Status: release
> 
> Description:
>   ^L doesn't clear the screen
>lithist is on, but  prints literal ^J instead of NL
>This is terminal-independent (mate-terminal, xterm, rxvt)
> 
> Repeat-By:
> $ ^L

You don't say which editing mode you're using, but ^L has never cleared
the screen in vi input mode.

> 
> $ q()
>   {
>   :
>   }
> 
> $ q()^J{^J:^J}

I can't reproduce this using Mac OS X.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



read -e does not restore terminal settings correctly when interrupted if a trap is set

2014-09-07 Thread mickael9
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
uname output: Linux mickael-laptop 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 
07:40:19 CEST 2014 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 24
Release Status: release

Description:
Given the following script (test.sh) :

#!/bin/bash
cleanup() { :; }
trap cleanup 0
read -e dummy

Run the script ('bash test.sh') *in ZSH* and when it waits for an input,
interrupt it with Ctrl-C.

Your terminal is now messed-up. This can be verified by running 'cat 
-t' and
pressing Enter. ^M will be printed instead of a newline and password 
prompts such
as the one in sudo cannot be submitted by pressing Enter anymore.

I don't know whether this is caused by ZSH or bash, but using git 
bisect on
bash reveals that the problem was introduced by this commit :

http://git.savannah.gnu.org/cgit/bash.git/commit/?id=9b86eb22c434c8848c9d592cba32d7e8fdf61459

Please also note that the bug does NOT happen if the trap is not 
installed
(trap cleanup 0). There is definitely something strange going on.

Original issue : https://github.com/archlinuxfr/yaourt/issues/11