nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Environment variables - with or without $?

2017-03-23 17:45:25
robert wrote:
    Date:        Thu, 23 Mar 2017 17:35:55 -0400
    From:        Paul Fox <pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us>
    Message-ID:  
<20170323213556(_dot_)01E2251811CD(_at_)grass(_dot_)foxharp(_dot_)boston(_dot_)ma(_dot_)us>

  | really?  do tell!

If command (in the example I gave) is a function, posix requires that
X be set in the shell (for subsequent commands) whereas if it is a
binary, X must not be altered from whatever it was before.

In the function case, it is undefined whether (assuming it was not already
exported) X will be marked for export.

This is all just because of the way ksh implemented functions.

ah!  thanks.  in your first message you wrote:
        X=foo command
sets X, and exports it, for command only (provided command is a real
binary, if it is a sh function different rules apply, for no good reason
at all.)

somehow i interpreted "sh function" as "sh script" (which also
contrasts nicely with "real binary").  so i thought the difference you
were referring to had to do with whether command was an executable or
not.  that would have surprised me greatly.

but in any case, i'd never really considered what happens if command
is a function, so thanks for this small digression.

paul
=----------------------
paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, where 
it's 30.0 degrees)


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>