whatever command you execute on a command line kicks off a process that is a child of the shell: in the case of a command that takes a little bit of time, that delay is shown as a blank line -- only after the command completes do you see another shell prompt. a Bourne family shell has an internal table of environment variables that are to be exported to child processes. in general, your environment variables are not copied into the environment of child processes unless you have used the export command to tell the shell to put them into the export table. the following code uses the sh command, but the same results work if you would use the ls command or any other external command.
$ BUGGY=bug $ sh # this spawns a shell as a child of the shell used above $ set | grep BUGGY # using the child shell $ # still using the child shell $ exit # using the child shell, telling the child shell to kill itself $ # child shell gone, this is the original shell $ BUGGY=bug $ sh export BUGGY $ sh # create the child shell $ set | grep BUGGY # using the child shell BUGGY=bug $ # still using the child shell $ exit # terminating the child shell $ # child shell gone, parent is back On Mon, 2008-08-11 at 13:00 -0700, D. Adam Karim wrote: > $(export env Foo=) is the same as using $(export Foo=) so save yourself > from the extra typing! Also to note, closing the shell is not necessary > to remove the variable from your shell, just use $(unset Foo) and you're > good to go. > > Glad that you're now able to do a build. Good luck on your BSD hacking > ;) > > On Mon, Aug 11, 2008 at 01:50:08PM -0600, macintoshzoom wrote: > > OK, so the proper command is the original one, no matter if ksh is shell or > > not. > > Thanks Nick and Adam. > > > > I got confused by the fact that: > > > > $ env FOO= > > _=/usr/bin/env > > bla bla > > FOO= > > $ > > > > but then if I do > > > > $ env |grep FOO > > no trace of FOO > > $ > > > > So I understand that env sets the environment temporary ONLY for the > > command line. > > > > but when doing > > > > $ export env FOO= > > $ env |grep FOO > > FOO= > > $ > > > > the temporary env FOO= stays in successive new commands till I close the > > konsole, a feature that I like and use very usually. > > > > Mac > > > > Nick Guenther wrote: > >> On Mon, Aug 11, 2008 at 1:54 PM, macintoshzoom > >> <[EMAIL PROTECTED]> wrote: > >>> I have a dude in this command, at least for people running this from KDE > >>> konsole or konqueror: > >>> > >>> At http://www.openbsd.org/faq/faq5.html , > >>> section 5.3.5 - Building the userland : > >>> ... > >>> Make sure all the appropriate directories are created. > >>> # cd /usr/src/etc && env DESTDIR=/ make distrib-dirs > >>> ... > >>> > >>> But it seems to me that the proper command for this (from KDE) should be: > >>> > >>> # cd /usr/src/etc && export env DESTDIR=/ make distrib-dirs > >>> > >>> > >>> as "export env", not "env" is the proper command for KDE consoles, > >>> e.g. when > >>> $ echo $SHELL > >>> /bin/ksh > >>> $ > >>> > >>> Can any one give me some light about this? > >>> > >> > >> 'env' is a command that takes a list of environment variables to > >> temporarily define and then runs the command that you give it in that > >> new environment. > >> 'export' is a command that takes a list of strings, treats them as > >> environment variables, and pushes those variables out to the world > >> outside of your current shell (that's why you have to use export in > >> .profile, because .profile gets run in its own subshell, just like > >> every script). > >> > >> "export env DESTDIR=/ make distrib-dirs" doesn't mean anything. Well, > >> rather, it does not mean what you think it does. Try this: > >> $ export env DESTDIR=/ make distrib-dirs > >> $ set #shows the current environment variables > >> > >> Anyway, why would using KDE have any impact on how commands in a shell > >> work? > >> > >> I hope that helps clear up your understanding? > >> -Nick > >> > _______________________________________________ Openbsd-newbies mailing list [email protected] http://mailman.theapt.org/listinfo/openbsd-newbies
