Coprocess FD not available when duplicated to FD other than 1 or 2

2016-10-19 Thread lolilolicon
The following correctly prints "fd=2": coproc p { head -1; } 2>&${p[1]} bash -c 'echo fd=2 >&2' cat <&${p[0]} Change 2 to 3, throws error: "bash: 3: Bad file descriptor": coproc p { head -1; } 3>&${p[1]} bash -c 'echo fd=3 >&3' cat <&${p[0]} I'm not very familiar with re

Re: Assigning to BASHPID fails silently

2016-10-19 Thread Chet Ramey
On 10/17/16 2:38 PM, Martijn Dekker wrote: > bash 4.4.0 (I did not investigate other versions) does not produce an > error message if you try to assign something to the BASHPID readonly > using either arithmetic or normal assignment. Other readonlies produce a > message on an assignment attempt. BA

Re: TIMEFORMAT in time ( )

2016-10-19 Thread Chet Ramey
On 10/16/16 6:01 PM, isabella parakiss wrote: > $ cat myscript > TIMEFORMAT=foo var=x > > time ( TIMEFORMAT=bar var=y ) > echo "<$TIMEFORMAT> <$var>" > > f() { TIMEFORMAT=f; time :; } > time ( f ) > echo "<$TIMEFORMAT>" > > > $ bash myscript > bar > > f > f > > > > > setting TIMEFORMAT in

Re: Coprocess FD not available when duplicated to FD other than 1 or 2

2016-10-19 Thread Chet Ramey
On 10/19/16 8:24 AM, lolilolicon wrote: > The following correctly prints "fd=2": > > coproc p { head -1; } > 2>&${p[1]} bash -c 'echo fd=2 >&2' > cat <&${p[0]} > > Change 2 to 3, throws error: "bash: 3: Bad file descriptor": > > coproc p { head -1; } > 3>&${p[1]} bash -c 'ech

Re: How bash do tokenization?

2016-10-19 Thread Peng Yu
OK. I see it, which check emails and print prompt. What factors people need to consider to decide whether to use flex to perform tokenization and write a customize tokenizer? Checking emails and printing prompt strictly speaking is not related with tokenization. Is there an alternative way to org

bash history / ssh+sudo+reverse-i-search will execute the command found if the ssh process is killed

2016-10-19 Thread Stein Arne Storslett
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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -

Re: Assigning to BASHPID fails silently

2016-10-19 Thread Martijn Dekker
Op 19-10-16 om 15:18 schreef Chet Ramey: > On 10/17/16 2:38 PM, Martijn Dekker wrote: >> bash 4.4.0 (I did not investigate other versions) does not produce an >> error message if you try to assign something to the BASHPID readonly >> using either arithmetic or normal assignment. Other readonlies pr

Re: Assigning to BASHPID fails silently

2016-10-19 Thread Eduardo A . Bustamante López
On Wed, Oct 19, 2016 at 11:53:37PM +0200, Martijn Dekker wrote: [...] > Assigning to BASHPID most certainly does have an effect. Since you > didn't quote that part, I think you might have missed my point that > attempting this will silently exit the shell without any error message, > causing the pr