bug-bash
[Top][All Lists]
Advanced

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

bash process substitution weird behavior


From: Hyunho Cho
Subject: bash process substitution weird behavior
Date: Tue, 8 Dec 2015 21:03:08 +0900 (KST)

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 EliteBook 4.2.0-19-generic #23-Ubuntu SMP Wed Nov 11 
11:39:30 UTC 2015 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:


1.

BASH$ { echo 111; echo 222 ;} 2> >( echo -en "\e[01;31m" >&2; read line; echo 
"$line" >&2; echo -en "\e[0m" >&2 ) >&2 

111        # result is one line and red-colored that is expected behavior.



2.

# If i remove ">&2" that is at the end of command
# result is two lines with white-colored that is also expected behavior. 

BASH$ { echo 111; echo 222 ;} 2> >( echo -en "\e[01;31m" >&2; read line; echo 
"$line" >&2; echo -en "\e[0m" >&2 )

111        # white colored
222        # white colored    



3. 

# If i add external "date" command in the middle of two echo commands
# result is in red-colored after external date command output
# i think there must be no red-colored because { echo 111; date; echo 222 ;} 
only direct to stdout

BASH$ { echo 111; date; echo 222 ;} 2> >( echo -en "\e[01;31m" >&2; read line; 
echo "$line" >&2; echo -en "\e[0m" >&2 )

111                                                   # white colored
Tue Dec  8 20:33:33 KST 2015       # red colored
222                                                   # red colored




reply via email to

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