On Sunday, July 21, 2013 07:53:33 PM Peng Yu wrote:
> Hi,
>
> myvar=XXX cat <(echo "$myvar")
>
> myvar in <() won't get the value XXX. I could use export to split the
> above line into two lines as in the following.
>
> export myvar=XXX
> cat <(echo "$myvar")
>
> But is there an one line command for it? Thanks.
>
Bash will hold open the fd in certain cases.
$ x=foo y=<(echo "$x") command eval cat '"$y" - <<<"$x"'
foo
foo
The scoping rules differ from variable scope somewhat. The rules I could
deduce (a few years ago) are here:
http://wiki.bash-hackers.org/syntax/expansion/proc_subst#scope
--
Dan Douglas
[Prev in Thread]
Current Thread
[Next in Thread]
Re: [Help-bash] Use one line for myvar=XXX cat <(echo "$myvar"),
Dan Douglas<=