[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating directories with sticky bit set

From: Greg Wooledge
Subject: Re: Creating directories with sticky bit set
Date: Fri, 13 Mar 2009 09:30:43 -0400
User-agent: Mutt/

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]