Re: Doesn't MY_ENV=abc printf "${MY_ENV}\n" suppose to print abc?
* Shaul Karl (shaul@actcom.net.il) wrote:
> On Sat, Aug 02, 2003 at 10:22:19PM +0100, iain d broadfoot wrote:
> > * Shaul Karl (shaul@actcom.net.il) wrote:
> > > Package: bash
> > > Version: 2.05b-8.1
> > >
> > > According to my understanding of the manual page,
> > >
> > > $ MY_ENV=abc printf "${MY_ENV}\n"
> > >
> > > Should have print abc. But it does not:
> > >
> > > $ MY_ENV=abc printf "${MY_ENV}\n"
> > >
> > > $
> > >
> > > What am I missing?
> >
> > an 'export' and a ';', like so:
> >
> > $ export MY_ENV=abc ; printf "${MY_ENV}\n"
> > abc
> >
>
>
> Your proposal has some side effects which might be undesirable. More
> specifically, with your proposal MY_ENV will be set until you
> explicitly unset it or exit the shell. With what I tried to do, MY_ENV
> will only be set for the following command. There will be no need to
> explicitly unset it or exit the shell in order for it to disappear
> afterwards. In addition, the construct I am trying to use is a well
> known construct and the man page says it should work. Is it a bug?
i can't see in the man page an example like the one you show, what
section is it in?
> Can you try on your machine the line that I have asked about and see
> if that is working for you? What version of bash are you using?
i get the same results as you.
the other respondent explained the reason for the (apparent) problem, i
think.
iain
--
wh33, y1p33 3tc.
"If sharing a thing in no way diminishes it, it is not rightly owned if it is
not shared." -St. Augustine
Reply to: