BASH {VARNAME}>&- redirection (was: Re: Konsole is not bash)

2023-08-22 Thread Max Nikulin
On 23/08/2023 02:59, Greg Wooledge wrote: bar() { local fd foo {fd}>&1 1>&2 2>&${fd} {fd}>&- } Running this appears to gives the correct results -- outputs go to the right places -- but it leaves the temporary FD open. The final redirection to close it doesn't work. At first glance

Re: Konsole is not bash

2023-08-22 Thread Greg Wooledge
See, this is why I hate using bash extensions. So many weird corner cases and surprises As it turns out, the answer I gave yesterday was only partially correct. The "pure sh" solution is fine, but I offered this bash alternative: cmd {fd}>&1 1>&2 2>&$fd {fd}>&- This doesn't actually

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
On Mon, Aug 21, 2023 at 09:19:00AM +0700, Max Nikulin wrote: > On 21/08/2023 01:48, Greg Wooledge wrote: > > Some shell features do change over time, but the significant > > ordering of redirections has remained stable ever since the original > > Bourne shell. > > An exercise that relies on order

Re: Konsole is not bash

2023-08-20 Thread Max Nikulin
On 21/08/2023 01:05, Felix Miata wrote: In the most recent versions of Konsole I've started (5.27.x), the default profile has inexplicably been changed from /bin/bash to /bin/sh. Is it konsole or plasma version? May it happen that /bin/sh was just saved to your konsole config files or it is

Re: Konsole is not bash

2023-08-20 Thread Max Nikulin
On 21/08/2023 01:48, Greg Wooledge wrote: Some shell features do change over time, but the significant ordering of redirections has remained stable ever since the original Bourne shell. An exercise that relies on order of redirections and thus demonstrates its importance: Swap stderr and

Re: Konsole is not bash

2023-08-20 Thread gene heskett
On 8/20/23 14:23, Greg Wooledge wrote: On Sun, Aug 20, 2023 at 02:05:49PM -0400, Felix Miata wrote: Bob Weber composed on 2023-08-20 11:04 (UTC-0400): gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the

Re: Konsole is not bash

2023-08-20 Thread John Hasler
Gene writes: > And that order of arguments is not mentioned in the bash scripting > manual It isn't an argument. It's an instruction to the shell. See the REDIRECTION section of the bash man page. -- John Hasler j...@sugarbit.com Elmwood, WI USA

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
On Sun, Aug 20, 2023 at 02:27:38PM -0400, gene heskett wrote: > I should have prefaced cmd with a $ sign but forgot to add it in my post, > cmd was meant to be whatever I wanted to trace, in this case digiKam which > is the current 8.1.0 AppImage, probably updated by now as the do that about >

Re: Konsole is not bash

2023-08-20 Thread gene heskett
On 8/20/23 10:52, Cindy Sue Causey wrote: On 8/20/23, gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? Well, I started out attempting to play along in xfce4-terminal and received: bash:

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
On Sun, Aug 20, 2023 at 02:05:49PM -0400, Felix Miata wrote: > Bob Weber composed on 2023-08-20 11:04 (UTC-0400): > > > gene heskett wrote: > > >> I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. > >> What > >> terminal actually uses bash for the heavy lifting? > > >

Re: Konsole is not bash

2023-08-20 Thread gene heskett
On 8/20/23 10:36, Greg Wooledge wrote: On Sun, Aug 20, 2023 at 10:28:44AM -0400, gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? The terminal is irrelevant. This is entirely done in the

Re: Konsole is not bash

2023-08-20 Thread Felix Miata
Bob Weber composed on 2023-08-20 11:04 (UTC-0400): > gene heskett wrote: >> I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. >> What >> terminal actually uses bash for the heavy lifting? > In konsole its in the settings for the profile you are using.  Mine just says

Re: Konsole is not bash

2023-08-20 Thread Bob Weber
On 8/20/23 10:28, gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? Cheers, Gene Heskett. In konsole its in the settings for the profile you are using.  Mine just says bash not /usr/bin/bash. 

Re: Konsole is not bash

2023-08-20 Thread Cindy Sue Causey
On 8/20/23, gene heskett wrote: > I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in > Konsole. What terminal actually uses bash for the heavy lifting? Well, I started out attempting to play along in xfce4-terminal and received: bash: tmp/cmd.log: No such file or directory Next

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
On Sun, Aug 20, 2023 at 10:28:44AM -0400, gene heskett wrote: > I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. > What terminal actually uses bash for the heavy lifting? The terminal is irrelevant. This is entirely done in the shell. Your redirections are backwards.

Konsole is not bash

2023-08-20 Thread gene heskett
I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author,