patkar@bromine.ecn.purdue.edu (The Silent Dodo) (08/21/90)
Having created enough confusion by asking the question about changing quadruple occrances to single ones, here is one more simple question. It seems that by default, vi creates files which are in mode 644. Is there a way to change this default? I have some directories which contain only simple executable scripts. While creating new files in this directory, it will be nice if the mode is automatically changed. Also, in some other directories I would like the mode to be read-only. You get what I mean! I can write a simple script like cp /dev/null $1 chmod 700 $1 vi $1 But this looks clumsy. Is there a better way than this? Probably there is some option you can set in your .exrc, but I could not find any such thing in the online help command. -- Anant (patkar@cn.ecn.purdue.edu)
yuf@sequent.UUCP (Kyle Grieser) (08/21/90)
In article <1990Aug20.180936.29942@ecn.purdue.edu> patkar@bromine.ecn.purdue.edu (The Silent Dodo) writes: > cp /dev/null $1 > chmod 700 $1 > vi $1 > > But this looks clumsy. Is there a better way than this? > Probably there is some option you can set in your .exrc, but > I could not find any such thing in the online help command. This really has nothing to do with vi. As you may have noticed, the "cp /dev/null $1" probably made the file 644 also. This is what the file will always be made as. You need to set your umask to be something that will mask the permission bits when you make a file. Basically, "umask 022" in your .profile (or .login) will make files of modes 755 and 644 while umask 077 will make them 700 and 600. Read the man page for umask for a clearer understanding of how it works. It basically uses the umask value as a mask for the permission bits. ---- Kyle Grieser ...!sequent!yuf Sequent Computer Systems Inc. sequent!yuf@uunet.uu.net 15450 S.W. Koll Parkway Beaverton, OR 97006 (503) 626-5700