bug-coreutils
[Top][All Lists]
Advanced

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

Re: mkdir owner:group option


From: Mike Frysinger
Subject: Re: mkdir owner:group option
Date: Tue, 10 Mar 2009 06:07:17 -0400
User-agent: KMail/1.11.1 (Linux/2.6.28; KDE/4.2.1; x86_64; ; )

On Tuesday 10 March 2009 05:54:49 Jim Meyering wrote:
> Pádraig Brady wrote:
> > Caleb Cushing wrote:
> >> be awesome if mkdir had a way to specify the user:group ownership
> >> being made. given this would be limited by perms. but as root it could
> >> be good.
> >>
> >> just throwing it out there.
> >
> > Perhaps a simple wrapper around install would be better?
> >
> > mkudir() { u="$1"; g="$2"; shift 2; install -d -o$u -g$g "$@"; }
>
> For the record, you can (and IMHO should; less syntax is better) avoid
> quoting a simple $var on the RHS, and you must double-quote _uses_ of
> variables like $u and $g that may potentially contain meta-characters:
>
> mkudir() { u=$1; g=$2; shift 2; install -d -o"$u" -g"$g" "$@"; }

i'd suggest marking u/g as local, or subshelling the whole thing.  dont want 
to corrupt the env of the caller ...

mkudir() { (u=$1; g=$2; shift 2; install -d -o"$u" -g"$g" "$@"); }
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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