bug-bash
[Top][All Lists]
Advanced

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

Re: Code for :"Re: HERE document failed && Re: /dev/fd/62: No such file


From: Angel
Subject: Re: Code for :"Re: HERE document failed && Re: /dev/fd/62: No such file or directory"
Date: Tue, 29 Jul 2014 22:21:36 +0200

Linda Walsh wrote
> 
> Andreas Schwab wrote:
> > Linda Walsh <bash@tlinx.org> writes:
> > 
> >>    Except that in-line HERE docs don't need to be implemented
> >> through a tmp file unless you want to slow things down.
> >>    They should be read out of memory and NOT transfered to
> >> to non-existent, external storage.
> > 
> > You need a file descriptor for your memory storage.
> ---
> Why?

Because that's what the input command expects: your HERE-string *when it
reads its standard input* (fd 0)

You could implement it with pipes, but as you would need a thread to
write the partially-read string, just using a file is simpler. And as
you can write it into a deleted file, the effect on storage should be
minimal.

You should however be able to translate “foo <<<SOMETHING” into “echo
SOMETHING | foo”


What surprises me is that the only use of here-docs (actually
here-strings) in your script are process substitutions:
> read out <<<$(declare -p "$var" )
> while ... done <<<"$(get_net_IFnames_hwaddrs)"

When it looks simpler to write the non-here version:
> declare -p "$var" | read out
> get_net_IFnames_hwaddrs | while ...


Regards




reply via email to

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