On Thu, Mar 12, 2009 at 07:40:58PM -0700, Ian Kelling wrote:
> mkdir also has the -m argument, so you could do
> mkdir -m 1755 dir
Ah, clever. Then:
mkdir() {
command mkdir -m $(printf '%o\n' $((01777 - $(umask)))) "$@"
}
This still doesn't address the original poster's concerns if, for
example, a web browser creates a new ~/.browserconf directory the first
time it's invoked. But nothing bash can do will solve that.
One small problem, though: it doesn't seem to work on all platforms.
(This is with the real mkdir(1).)
imadev:~$ mkdir -m 1755 xyz
imadev:~$ ls -ld xyz
drwxr-xr-x 2 wooledg pgmr 96 Mar 13 09:20 xyz
imadev:~$ uname -sr
HP-UX B.10.20