[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash uses tmp files for inter-process communication instead of pipes
From: |
Greg Wooledge |
Subject: |
Re: bash uses tmp files for inter-process communication instead of pipes? |
Date: |
Tue, 7 Oct 2014 08:29:21 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Mon, Oct 06, 2014 at 04:04:25PM -0700, Linda Walsh wrote:
> Greg Wooledge wrote:
> >netdev_pat=... # (and other variable assignments)
> >(cd "$sysnet" &&
> >for ifname in ...; do
> > hwaddr=$(<"$ifname"/address)
> > act_hw2if[$hwaddr]="$ifname"
> > act_if2hw[$ifname]="$hwaddr"
> >done)
>
> Except that either act_hw2if + pair were just assigned to
> in the sub process that was meant to isolate the change
> of directory from the rest of the program,
> OR
> we aren't in the right directory when we do the reads.
OK, then use a function to give you an escapable block:
declare -A ...
create_maps() {
cd "$sysnet" || return
for ifname in ...; do
hwaddr=$(<"$ifname"/address)
act_hw2if[$hwaddr]="$ifname"
act_hw2if[$ifname]="$hwaddr"
done
}
create_maps
> Either way, they code as you have suggested won't work
> without overcoming another set of side effects.
There are ways to NOT use subshells. I have given you two of those
ways now.
- bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Greg Wooledge, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Pierre Gaston, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Greg Wooledge, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Greg Wooledge, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/06
- Re: bash uses tmp files for inter-process communication instead of pipes?,
Greg Wooledge <=
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Greg Wooledge, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Pierre Gaston, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Greg Wooledge, 2014/10/08
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/09
- Re: bash uses tmp files for inter-process communication instead of pipes?, Chet Ramey, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Linda Walsh, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Chet Ramey, 2014/10/07
- Re: bash uses tmp files for inter-process communication instead of pipes?, Pierre Gaston, 2014/10/07