------- Original Message -------
On Monday, February 20th, 2023 at 1:51 AM, Greg Wooledge <greg@wooledge.org>
wrote:
> On Sun, Feb 19, 2023 at 10:00:17AM +0000, goncholden wrote:
>
> > theone()
> > (
> > for arg in "$@"
> > do
> > while IFS= read -r vl
> > do
> > printf '## vl: %s ##\n' "$vl"
> > done <<< "$arg"
> > done
> > )
Does the problem of disappearing variables exist in
calls to awk ?
for arg in "$@"; do
printf '%s\n' "$arg" | awk '...'
done
or should one use
for arg in "$@"; do
awk '...' < <(printf '%s\n' "$arg")
done
There is also the possibility of putting the awk command in the process
substitution, not the printf command:
for arg in "$@"; do
while read ...; do
...
done < <(awk '...' <<< "$arg")
done