Re: possible bash bug bringing job. to foreground

2024-02-18 Thread John Larew
I was unaware of TMOUT. Now I have a backup as well. Thanks for tolerating my 
inexperience.
 
 
  On Sat, Feb 17, 2024 at 2:54 PM, Greg Wooledge wrote:   On 
Sat, Feb 17, 2024 at 07:41:43PM +, John Larew wrote:
> After further examination, the examples with "fg $$" and "fg $!" clearly do 
> not bring the subshell into the foreground, as they are evaluated prior to 
> the subshells background execution.
> I'm trying to bring the subshell to the foreground to perform an exit, after 
> a delay.
> Ultimately, it will be used as part of a terminal emulator inactivity timeout.

Bash already has a TMOUT variable which will cause an interactive shell
to exit after a specified length of inactivity.  Is that sufficient?
If not, how does your desired solution need to differ from TMOUT?
  


Inconsistent treatment of left-hand side of conditional expression where IFS is not its default value

2024-02-18 Thread Kerin Millar
Hi,

This report stems from the discussion at 
https://lists.gnu.org/archive/html/help-bash/2024-02/msg00085.html.

Consider the following two cases.

$ ( set a -- b; f=+ IFS=$f; [[ $f$*$f == *"$f--$f"* ]]; echo $? )
0

$ ( set a -- b; f=$'\1' IFS=$f; [[ $f$*$f == *"$f--$f"* ]]; echo $? )
1

It does not make sense that that the exit status value differs between these 
cases, especially since SOH is not a whitespace character (in the sense of 
field splitting). I think that the second case should also yield 0. Regardless 
of what the intended behaviour is, I would also expect for the manual to 
describe it.

Note that quoting the left-hand side fixes it for SOH. In the absence of 
quotes, xtrace output suggests that all of the SOH characters are stripped from 
the expansion of $f$*$f.

$ ( set a -- b; f=$'\1' IFS=$f; [[ "$f$*$f" == *"$f--$f"* ]]; echo $? )
0

-- 
Kerin Millar



Re: Inconsistent treatment of left-hand side of conditional expression where IFS is not its default value

2024-02-18 Thread Lawrence Velázquez
On Sun, Feb 18, 2024, at 5:03 PM, Kerin Millar wrote:
> Hi,
>
> This report stems from the discussion at 
> https://lists.gnu.org/archive/html/help-bash/2024-02/msg00085.html.
>
> Consider the following two cases.
>
> $ ( set a -- b; f=+ IFS=$f; [[ $f$*$f == *"$f--$f"* ]]; echo $? )
> 0
>
> $ ( set a -- b; f=$'\1' IFS=$f; [[ $f$*$f == *"$f--$f"* ]]; echo $? )
> 1
>
> It does not make sense that that the exit status value differs between 
> these cases, especially since SOH is not a whitespace character (in the 
> sense of field splitting). I think that the second case should also 
> yield 0. Regardless of what the intended behaviour is, I would also 
> expect for the manual to describe it.
>
> Note that quoting the left-hand side fixes it for SOH. In the absence 
> of quotes, xtrace output suggests that all of the SOH characters are 
> stripped from the expansion of $f$*$f.
>
> $ ( set a -- b; f=$'\1' IFS=$f; [[ "$f$*$f" == *"$f--$f"* ]]; echo $? )
> 0

Case commands exhibit similar behavior:

$ set a -- b
$ (f=+ IFS=$f; case $* in *"$f"*) echo 0;; *) echo 1;; esac)
0
$ (f=$'\1' IFS=$f; case $* in *"$f"*) echo 0;; *) echo 1;; esac)
1
$ (f=$'\1' IFS=$f; case "$*" in *"$f"*) echo 0;; *) echo 1;; esac)
0


-- 
vq