On Tue, Mar 31, 2015 at 9:26 AM, Paul Gilmartin <0000000433f07816-dmarc-requ...@listserv.ua.edu> wrote: > On Tue, 31 Mar 2015 09:11:32 -0500, John McKown wrote: >> >>$(echo export BUBBA=bubba) # run the stdout of the enclosed command as >>commands in the parent shell. >> > In most cases, I'd be more comfortable with: > > export BUBBA=$(echo bubba) # limit the scope of the damage.
That is safer. But it is restricted to only setting one environment variable. My example was the smallest, simplest that I could come up with quickly. If I wanted to set multiple environment variables, I'd "protect" myself a bit with something like: $(somecommand ... | egrep '^export +(VAR1|VAR2|VAR3)=') This would ensure that regardless of what "somecommand" wrote to stdout, I'd just do export commands for the environment variables that I was interested in. It is a _little bit_ safer. After setting them, I might want to validate them as well, somehow. > > Note the serialization concerns. In neither case is the set value available > to concurrent processes. > <snip> > -- gil > -- If you sent twitter messages while exploring, are you on a textpedition? He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN