help-bash
[Top][All Lists]
Advanced

[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: Pierre Gaston
Subject: Re: [Help-bash] Use one line for myvar=XXX cat <(echo "$myvar")
Date: Mon, 22 Jul 2013 07:43:47 +0300

On Mon, Jul 22, 2013 at 3:53 AM, Peng Yu <address@hidden> 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.
>
> --
> Regards,
> Peng
>
it sets myvar in the environment of cat, echo $myvar runs is in an
unrelated process.
Generally the environment is not useful for echo $myvar since it's an
expansion performed by the shell before echo runs.

>From your  example it's not clear what problem you are trying to solve
so it's hard to give you a meaningful workaround. (eg echo XXX
"works")



reply via email to

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