home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Bug_Fixes / Net.v7bugs / 0034 < prev    next >
Encoding:
Text File  |  1981-10-08  |  1.4 KB  |  31 lines

  1. Aharpo.577
  2. net.v7bugs
  3. utzoo!decvax!duke!chico!harpo!jerry
  4. Mon Oct  5 21:27:24 1981
  5. why export shell variables
  6. I am putting this in net.v7bugs because the item I am replying to
  7. appeared there.  However, the requirement that variables be explicity
  8. exported before seting them changes the environment is not a bug.
  9. It was, I have been told, a deliberate decision and there are reasons
  10. for it.
  11.  
  12. The bourne shell is dealing with environment values, and its own local
  13. variables.  Unlike csh, it uses the same syntax to set these different
  14. kinds of values.  Therefore, it requires a declaration of some sort
  15. to distinguish them.  It uses "export".  I suppose requiring local
  16. variables to be declared would also be reasonable.  Local variables
  17. are important in writing shell procedures and it would be a real loss
  18. to eliminate the distinction between them and environment variables.
  19.  
  20. Problems arise because people frequently set up an interactive shell
  21. (e.g. via an escape from the editor) and don't realize that they must
  22. export a variable before they can change its value in the environment.
  23. For this reason, I would prefer to make the distinction in
  24. the assignment syntax (ala csh).  But, I consider the current situation
  25. preferable to one in which a shell procedure might inadvertantly
  26. interfer with the transfer of a value from outside (i.e.
  27. the environment) to a command that it invokes.
  28.  
  29.                         Jerry Schwarz
  30.                         harpo!jerry
  31.