home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v5 / text0037.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  1.6 KB

  1. Date: Tue, 4 Feb 86 14:05:09 est
  2. >From: "Charles J. Antonelli" <cja%eecs.umich.csnet@CSNET-RELAY.ARPA>
  3. Summary: Use an appropriate alias for `cd' [ Nope. -mod ]
  4. Organization: University of Michigan EECS Dept.
  5.  
  6. I obtained the following idea from a colleague.  It can be used with csh
  7. to achieve the desired effect.  Define the following alias:
  8.  
  9. alias cd 'if (-o .exit ) source .exit; chdir \!*; if (-o .enter ) source .enter'
  10.  
  11. Then create .enter and .exit files within the directories whose umasks
  12. are to be controlled; the files contain the appropriate umask commands along
  13. with anything else you wish to do whenever a directory is entered or exited.
  14. In my case the new umask is echoed for verification.
  15.  
  16. The .exit file is useful mainly in those cases where only a small subset
  17. of the directories have .enter files; if every directory has one then
  18. .exit is not strictly necessary.
  19.  
  20. The alias checks for ownership to prevent possible corruption.
  21.  
  22. Charles J. Antonelli        Phone:  (313) 763-1563
  23. The University of Michigan    Csnet:  cja@eecs.UMICH
  24. 1508 East Engineering        Usenet: cja@umich.UUCP
  25. Ann Arbor, MI   48109            ihnp4!umich!cja
  26.  
  27. [ This is one of several such shell initialization schemes I've
  28. received (and the only one I'm going to post).  They all miss the
  29. point:  a new file should be created according to the modes of its
  30. *parent* directory, not the creating process's *current* directory.
  31. That is, "cat this > there/that" should create "that" with the same
  32. modes regardless of where "." is.  (If "there" has the directory umask
  33. feature enabled.)  -mod ]
  34.  
  35. Volume-Number: Volume 5, Number 38
  36.  
  37.