Sven Joachim wrote: > David Baron wrote: > > > Any attempt to chown -R thisuser:thisuser /home/thisuser/.* Gack! :-( > > For example,to reset permissions of hidden items, will change ALL > > users' home folders, everything. Actually, on the surface, this > > might seem correct behavior because of the '.' This is, of course, > > a catastrophe. Their kde, etc, is unusable. Yes. Like a sharp kitchen knife it is possible to cut a finger while chopping the vegetables. > Yes, that's a (dubious) feature required by POSIX. Anything else would be worst though. The '*' matches any character. Since '.' is a character then ".*" matches "..". Avoiding that would be writing a very special case. '*' matches any character except if the result of the entire match results in ".."? Please no special cases resulting in a complicated rule like that. > > How can I do this? > > Use ".[!.]*" instead of ".*". Or use zsh which will skip current and > parent directory when expanding ".*" . That works and is probably the simplest. As a historical note the old, old, old way was to know that '?' does not match a '.' character. Therefore ".??*" would match all hidden files that are longer than a single character. Since there aren't usually single character hidden files that usually works. And the remaining can be fixed up. But I question why the dot files need to be selected individually? Just change the entire home directory. chown -R thisuser:thisuser /home/thisuser No need to go looking further at that point. Anything more complicated and I would use 'find' which has ever possible file finding operation built in. Bob
Attachment:
signature.asc
Description: Digital signature