Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread felix
Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux medium 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Dennis Williamson
On Sun, Jun 28, 2020, 8:50 AM felix wrote: > >_out=$(date -d "$_string" +%s) > many time in same script, I run something like: > > _fifo=$(mktemp -u /tmp/fifo-) > mkfifo $_fifo > exec 9> >(exec stdbuf -o0 date -f - +%s >$_fifo 2>&1) > exec 8<$_fifo > rm $_fifo > >

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Eli Schwartz
On 6/28/20 11:55 AM, Dennis Williamson wrote: > How is running your > > echo >&9 $_string > read -t 1 -u 8 _out > > many times better than running your > >_out=$(date -d "$_string" +%s) > > many times? > > Why don't you just use a function? > > date_to_epoch () { > dat

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Oğuz
28 Haziran 2020 Pazar tarihinde felix yazdı: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. > -fstack-protector-strong -Wformat -Werror=format-security -Wall > -Wno-parentheses -Wno-format-security > uname output: Li

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread felix
In order to prevent ressource eating, once `date -f - +%s` runned as background, date_to_epoch will become: $ exec 8<> <(:) $ exec 9> >(exec stdbuf -o0 date -f - +%s >&8 2>&8) $ date_to_epoch() { echo >&9 ${@:2} read -t 1 -u 8 ${1:-answeredEpoch} } $ date_to_epoch _out 2009-02-13 23:31:3

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread felix
I totally agree, but this work from at least bash-3.2 upto last version! But if a bug, a feature request: exec 8< 9> <>(date -f - +%s) ( ..or, but I don't imagine how this could be implemanted: exec 8<> <>(date -f - +%s) :-p ) ... AND even: Same `-u` option for `read -u $FD` available for

An xtrace variant

2020-06-28 Thread Dale R. Worley
When debugging a shell script, a useful command is: bash -x script-name The deficiency of this is that "-x" causes all simple commands in your startup files to be echoed as they are executed, and often this output is a lot longer than the output from the commands in the script. For a long ti

Re: An xtrace variant

2020-06-28 Thread Eli Schwartz
On 6/28/20 3:19 PM, Dale R. Worley wrote: > When debugging a shell script, a useful command is: > > bash -x script-name > > The deficiency of this is that "-x" causes all simple commands in your > startup files to be echoed as they are executed, and often this output > is a lot longer than th

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Robert Elz
Date:Sun, 28 Jun 2020 12:06:10 -0400 From:Eli Schwartz Message-ID: | You COMPLETELY failed to even read the reporter's message, which | specifically stated "In order to reduce forks and make some tasks a lot | quicker [...]" I noticed that explanation, but li

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Pierre Gaston
On Sun, Jun 28, 2020 at 3:50 PM felix wrote: > There is maybe something to document or even create a new feature > about open2 and open3... > Maybe "coproc" is already the feature you need (limited to only 1 though)?

Re: Undocumented feature: Unnamed fifo '<(:)'

2020-06-28 Thread Eli Schwartz
On 6/28/20 4:21 PM, Robert Elz wrote: > I noticed that explanation, but like Dennis, I fail to see how the > complicated version does any more than pretend there are less forks > happening. Was the speed of this actually measured, and if so, where > are the comparative results? Sure, and that ca

Re: An xtrace variant

2020-06-28 Thread Dale R. Worley
Eli Schwartz writes: > Why not just run bash -x script-name without the bash -l option and > without $BASH_ENV set? > > The first is implicitly true based on your stated command line. The > second doesn't seem like a high bar to set, and it's not exactly default > behavior... if you really do need