TIMEFORMAT in time ( )

2016-10-16 Thread isabella parakiss
$ cat myscript
TIMEFORMAT=foo var=x

time ( TIMEFORMAT=bar var=y )
echo "<$TIMEFORMAT> <$var>"

f() { TIMEFORMAT=f; time :; }
time ( f )
echo "<$TIMEFORMAT>"


$ bash myscript
bar
 
f
f




setting TIMEFORMAT in ( ) affects time out of the subshell
this cannot be right

---
xoxo iza



Re: TIMEFORMAT in time ( )

2016-10-16 Thread lolilolicon
On Mon, Oct 17, 2016 at 6:01 AM, isabella parakiss  wrote:
>
> f() { TIMEFORMAT=f; time :; }
> time ( f )
> f
> f
>
> setting TIMEFORMAT in ( ) affects time out of the subshell
> this cannot be right

time is a reserved word, not a builtin. time is not "out of the
subshell". Its env is that of the subshell, I think.