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

Re: Doesn't MY_ENV=abc printf "${MY_ENV}\n" suppose to print abc?



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?

  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?
-- 

    Shaul Karl,    shaul @ actcom . net . il



Reply to: