Permissions

Permissions determine the access allowed to a file. In an earlier chapter, you looked at permission basics. We proposed that the umask value could be subtracted from octal 777 for directories and octal 666 for nondirectory files. The truth is a bit more complicated, and because you've made it this far in the book, you might as well know the truth. If you consider that the umask value can be set to octal 777—which is an extreme and unusual value, but legitimate nonetheless—you can deduce that the subtraction technique presented earlier, while useful, is flawed. With a umask of 777, the subtraction technique yields -1,-1,-1, which makes no sense.

The one's complement of the umask is derived and then bitwise ANDed with the raw permission ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.