[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Use one line for myvar=XXX cat <(echo "$myvar")
From: |
Dan Douglas |
Subject: |
Re: [Help-bash] Use one line for myvar=XXX cat <(echo "$myvar") |
Date: |
Sun, 11 Aug 2013 19:12:26 -0500 |
User-agent: |
KMail/4.10.5 (Linux/3.10.1-pf+; KDE/4.10.5; x86_64; ; ) |
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 <=