[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: history separates >| and 2>&1 tokens when recalled with !*
From: |
Piotr Grzybowski |
Subject: |
Re: history separates >| and 2>&1 tokens when recalled with !* |
Date: |
Fri, 22 Apr 2016 11:24:43 +0200 |
Hi,
It is a history_tokenize_word problem, please consider the following:
diff --git a/lib/readline/histexpand.c b/lib/readline/histexpand.c
index fdecebc..ca4b4c8 100644
--- a/lib/readline/histexpand.c
+++ b/lib/readline/histexpand.c
@@ -1447,7 +1447,8 @@ history_tokenize_word (string, ind)
return i;
}
else if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
- (peek == '>' && string[i] == '&'))
+ (peek == '>' && string[i] == '&') ||
+ (peek == '|' && string[i] == '>'))
{
i += 2;
return i;
cheers,
pg
On 22 Apr 2016, at 01:28, idallen@home.idallen.ca wrote:
> 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-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -D_FORTIFY_SOURCE=2
> -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall
> uname output: Linux idallen-oak 4.2.0-35-generic #40-Ubuntu SMP Tue Mar 15
> 22:15:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.3
> Patch Level: 42
> Release Status: release
>
> Description:
> The history recall !* incorrectly pulls apart the >| and 2>&1
> words, making them useless.
>
> Repeat-By:
> bash-4.3$ date >| /tmp/i
> bash-4.3$ who !*
> who > | /tmp/i
> bash: syntax error near unexpected token `|'
>
> bash-4.3$ date 2>&1
> Thu Apr 21 19:24:46 EDT 2016
> bash-4.3$ echo !*
> echo 2 >& 1
> 2
>