bug-coreutils
[Top][All Lists]
Advanced

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

bug#8749: mkdir: feature request --reference


From: Bob Proulx
Subject: bug#8749: mkdir: feature request --reference
Date: Sat, 28 May 2011 19:46:52 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Shaun Jackman wrote:
> My primary use case for this feature is to create a shell alias:
>       alias mkdir='mkdir --reference=.'
> so that in interactive shells, new directories are created with the same
> permissions as their parent directory.

If your primary purpose is for an alias then you can do it this way:

  alias mkdirchmod='mkdir -m $(stat -c %a .)'

  alias mkdirchmod='install -d -m $(stat -c %a .)'

However a shell function might serve you better:

  mkdirchmod() { mkdir "$@" ; chmod --reference=. "$@" ;}

But I think this task is better served by not doing it all and instead
using the technique of User Private Groups.

> My goal is to have directories in my personal home directory to have
> permission 755 and directories in my shared work space to have
> permission 775, so that other members of my group may create new files
> in shared directories. Files should have permission 755 so that members
> of my group cannot modify files that I've created.

The UPG (User Private Group) technique works very well in this
situation.  There is a lot of documentation available on UPG on the
net and so I won't include a specific pointer.  Search for it and you
will find a lot of information on it.  And different operating systems
deal with configuring it differently and so you would want to look at
documentation for your particular system.  But I highly recommend
using the technique.

I generally dislike combining the functionality of several different
commands into one command.  In this case combining mkdir and chmod and
I don't see any reason they can't be used individually.  Plus mkdir
already allows you to create directories with a specified permission
and this is feature creep into the area of the 'install' command which
also already allows creating directories of specified permissions.

Bob





reply via email to

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