help-bash
[Top][All Lists]
Advanced

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

Re: terminate read after not receiving additional input for some time


From: Koichi Murase
Subject: Re: terminate read after not receiving additional input for some time
Date: Tue, 6 Apr 2021 18:38:56 +0900

2021年4月6日(火) 18:15 Marco Ippolito <maroloccio@gmail.com>:
> > But I basically initialize this kind of variables with an empty string
> > because it can be affected by the external variables.
>
> But, just local without the ``='':
>
> a=x; f() { local a; echo "<$a>"; }; f
> <>

I'm confused. Have you looked at my examples after the above
paragraph? `local a' makes the variable unset *only when* a tempenv of
the same name is not defined for the function call and also `shopt -s
localvar_inherit' is not set. Your function `f' can be affected by

$ a=x f
<x>

where it should be noticed that the variable `a' is specified as
tempenv (i.e. there is no semicolon between `a=x' and `f'), or

$ shopt -s localvar_inherit; a=x; f
<x>

--
Koichi



reply via email to

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