[Top][All Lists]

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

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

From: Robert Elz
Subject: Re: [Nmh-workers] Environment variables - with or without $?
Date: Fri, 24 Mar 2017 06:38:12 +0700

    Date:        Thu, 23 Mar 2017 18:45:07 -0400
    From:        Paul Fox <address@hidden>
    Message-ID:  <address@hidden>

  | somehow i interpreted "sh function" as "sh script"

Believe it or not, that terminology has been used before (particularly
for scripts without a #! that the shell just forks and runs).  I suspect
it dates from before the more modern shell functions were added though.

But no, as you now understand, I meant this kind of thing

        ll() { ls -l "$@"; }

FOO=xx ll /tmp

sets FOO=xx for ll, and then exports it to the ls command inside, and
(if your shell implements this part of POSIX as written) leaves FOO
set in the shell with the value "xx" (maybe exported, maybe not.)

FOO=xx ls -l /tmp

does the same as far as ls is concerned, but is required not to
change the value of FOO in the shell (from unset, or whatever value
it had before.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]