[Top][All Lists]

[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: Chet Ramey
Subject: Re: bash uses tmp files for inter-process communication instead of pipes?
Date: Tue, 07 Oct 2014 10:21:02 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 10/6/14, 3:14 PM, Linda Walsh wrote:
> In running a startup script, I am endeavoring not to use tmp files
> where possible, As part of this, I sent the output of a command
> to stdout where I read it using the "variable read" syntax:
>    while read ifname hwaddr; do
>        printf "ifname=%s, hwaddr=%s\n" "$ifname" "$hwaddr"
>        act_hw2if[$hwaddr]="$ifname"
>        act_if2hw[$ifname]="$hwaddr"
>        printf "act_hw2if[%s]=%s, act_if2hw[%s]=%s\n"
> "${act_hw2if[$hwaddr]}" "${act_if2hw[$ifname]}"
>    done <<<"$(get_net_IFnames_hwaddrs)"
> Note, I used the <<<"$()" form to avoid process substitution -- as I was told
> on this list that the <<< form didn't use process substitution.

Correct, it does not.

> So I now get:
>> >>/etc/init.d/boot.assign_netif_names#192(get_net_IFnames_hwaddrs)> 
> echo eth5 a0:36:9f:15:c9:c2
> /etc/init.d/boot.assign_netif_names: line 203: cannot create temp file for
> here-document: No such file or directory
> Where am I using a HERE doc?

You're using a here-string, which is a variant of a here-document.  They
differ very little, mostly in syntax.  The internal implementation is

> More importantly, at this point, where is it trying to write?/(Read).
> Simple Q.  Why isn't it using some small fraction of the 90+G of memory
> that is free for use at this point?

Because the shell uses temp files for this.  It's a simple, general
solution to the problem of providing arbitrary data on stdin.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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