Re: DEBUG trap in a background shell steals controlling terminal forcing parent shell to exit

2024-06-27 Thread Chet Ramey
On 6/18/24 4:55 PM, Mark March wrote: I am working with a large Bash code base where most scripts disable job control and the DEBUG trap is used extensively. I noticed that if I tried to run my scripts in the background, the interactive shell that started them would immediately exit on any key

Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices

2024-06-27 Thread Zachary Santer
On Wed, Jun 26, 2024 at 11:50 PM Martin D Kealey wrote: > > > > On Thu, 27 Jun 2024 at 06:30, Chet Ramey wrote: >> >> On 6/26/24 2:18 PM, Zachary Santer wrote: >> >> >> On Tue, Jun 11, 2024, 12:49 PM Zachary Santer wrote: >> >>> >> >>> $ array=( zero one two three four five six ) >> >>> $ printf

Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices

2024-06-27 Thread Zachary Santer
On Thu, Jun 27, 2024 at 1:08 AM Oğuz wrote: > > Why not extend the arithmetic expansion syntax to allow generating multiple > results when subscripting indexed arrays? Like `${a[1; 2; 4]}', `${a[3..5; > 7]}', `${a[1..10..3]}', etc. Doing this, you lose the ability to provide the list of indices

Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices

2024-06-27 Thread Zachary Santer
On Thu, Jun 27, 2024 at 9:12 AM Zachary Santer wrote: > > This, though I would add the caveat that 'set -u'/'set -o nounset' > should cause this expansion to fail and the script to error out if you > supply an index without a matching value. > And I guess my "${array[@]( index )}" would give the

Re: history-search-backward clobbers history

2024-06-27 Thread Chet Ramey
On 6/19/24 9:45 AM, Andreas Schwab wrote: $ printf 'echo 1234\necho 2345\necho 3456\n' > history $ HOME=$PWD HISTFILE=history TERM=xterm bash --norc -i <<<$'\20\eb1\e[5~\nhistory\n\20\20\eb2\e[5~\nhistory' bash-5.3$ echo 1234 1234 bash-5.3$ history 1 echo 1234 2 echo 2345 3 ech

Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices

2024-06-27 Thread Martin D Kealey
On Thu, 27 Jun 2024, 17:08 Oğuz, wrote: > On Thursday, June 27, 2024, Martin D Kealey > wrote: > >> [...] > > > That's too much to read > You're under no obligation to read what I write, but then kindly don't pretend that you're "replying" to me. Perl is not a good example to follow. > Perl i

Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices

2024-06-27 Thread Oğuz
On Friday, June 28, 2024, Martin D Kealey wrote: > modern Perl scripts > No such thing. Perl is a dead language, and for good reason. Why limit this to subscripts? > Where else do you need it? > Why not use that for generating lists directly? > Doesn't brace expansion already do that? Why