Re: using exec to close a fd in a var crashes bash

2023-08-23 Thread Ángel
On 2023-08-23 at 10:34 -0400, Greg Wooledge wrote: > So... {var}> redirections were introduced in bash 4.1, and > varredir_close in bash 5.2. That means that in all versions from > bash 4.1 to 5.1, you will need the separate "exec {fd}>&-" to close > the temp FD. At this point, it hardly seems wo

Re: remove empty '' in ${var@Q} result?

2023-08-23 Thread Chet Ramey
On 8/20/23 12:20 PM, Clark Wang wrote: I did. It's on the list of possible things for the next version. Since it's only a cosmetic issue, it's not a high priority. Hi Chet, Is it possible to fix this in 5.3? It's not a bug, and it's not a high priority. -- ``The lyf so short, the c

Re: nofork comsub in PS1 + ignoreeof

2023-08-23 Thread Chet Ramey
On 8/19/23 4:23 AM, Grisha Levit wrote: When a nofork command substitution is in PS1 and ignoreeof is enabled, (sufficiently repeated) EOF doesn't actually cause the shell to exit: Thanks for the report. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars long

Re: using exec to close a fd in a var crashes bash

2023-08-23 Thread Andreas Schwab
On Aug 23 2023, Greg Wooledge wrote: > Then again... leaving an FD open in a shell script usually won't matter, > because the script will exit, and that'll just take care of it. The > only times it actually matters are long-running bash processes -- either > interactive shells, or some kind of we

Re: using exec to close a fd in a var crashes bash

2023-08-23 Thread Greg Wooledge
On Wed, Aug 23, 2023 at 09:50:36AM -0400, Zachary Santer wrote: > From the NEWS file [1]: > > o. The new `varredir_close' shell option causes bash to automatically close >file descriptors opened with {var}redirection unless they're arguments to the `exec' builtin. Hmm, interesting. > $ s

Re: using exec to close a fd in a var crashes bash

2023-08-23 Thread Zachary Santer
On Wed, Aug 23, 2023 at 1:48 AM Martin D Kealey wrote: > Chopping and changing behaviour in "permanent" releases creates a > maintenance nightmare. > Well now with Bash 5.2, we've got the varredir_close shell option, something savvy shell programmers would probably just always use, like lastpipe

Re: using exec to close a fd in a var crashes bash

2023-08-23 Thread alex xmb ratchev
On Tue, Aug 22, 2023, 21:00 Dale R. Worley wrote: > Is there any way to write a redirection "Redirect the fd whose number is > in $FOO to file /foo/bar?" OK, you can write 'bash -c "..."' and > i think there was a ' duplicate ' directive .. use that assemble a command string however you want.