help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'times' of the Parent Shell


From: Stan Marsh
Subject: Re: 'times' of the Parent Shell
Date: Sun, 02 Nov 2025 06:35:46 -0700

From:   Greg Wooledge
Subject:        Re: `times` of the Parent Shell
Date:   Sat, 1 Nov 2025 10:28:10 -0400

>I suppose there might be some alternative way to do it with the new
>non-forking command substitutions in bash 5.3, but I haven't played
>with those yet, and bash 5.3 is not widely installed at this point.

Yes.  This works in 5.3:

$ foo=$(times)
# This prints (almost) all zeroes - as expected, since it runs 'times' in
# a subshell.
$ echo "$foo"

$ foo=${ times; }
# But this prints the right thing!
$ echo "$foo"

Seems reasonable to me.  Don't we always assume that participants in
these forums are always running the latest version of the things we
discuss?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]