Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: chown completion



On May 4,  6:18pm, Oliver Kiddle wrote:
> Subject: chown completion
> 
> How could I avoid the two consecutive _files calls to specify files
> where either the user is not $usr or the group is not $grp?
> *(^u.$usr.g.$grp.) matches files where user is not $usr AND group is
> not $grp.

Comma-separated list:

	*(^u.$usr.,^g.$grp.)

> It could also restrict files to those owned by the current user (unless
> it is root) as you can't chown other people's files.

True.

> Any ideas on how it should deal with invalid users or groups? As it is,
> it displays `_path_files:330: unknown user' which isn't too bad really.

That line in _path_files really should be

	eval 'tmp1=( $~tmp1 )' 2>/dev/null

Most expansion errors will be caught before it gets that far, but not
those that result from "mistakes" in the globbing flags.  On the other
hand, if we'd suppressed that error message, you'd never have found:

> Incidentally, if I separate the user/groups with a colon, not a dot in
> the glob, I get this message:
>     _path_files:330: bad pattern: *(^g:users

I think this is related to the pattern that attempts to rewrite the glob
flags to implement the file-sort style.  I've had trouble with that before.

> +    if (( GID && $+commands[groups] )); then

Shouldn't you be using EGID there?

I don't know the answers to any of the other questions, sorry.



Messages sorted by: Reverse Date, Date, Thread, Author