Chown script

Paul Howarth paul at city-fan.org
Thu Oct 21 16:23:08 UTC 2004


Franco wrote:
> Hi, this script give me an error `ls': not a valid user
> i need to change the owner with a foldername.group
> i need to read a group of the folder and then change it with
> foldername.group group

You don't need to read the group name if you're not going to change it. You 
can just correct the userid without changing the groupid. The script I posted 
changes the userid and not the groupid.

> antonio tuozzo ha scritto:
> 
>> Franco wrote:
>>
>>> Sorry,
>>> i do an example, i have 2 folder in the same parent folder,
>>> pippo and pippo1 these have as owner and group pippo and pippo.
>>> I need to change just the owner in pippo.pippo and pippo1.pippo
>>>
>>>
>> If I have understand the problem....
>>
>> for I in 'ls /path/to/folder'

The problem you were seeing above is due to the quotes being wrong.

It should be ` rather than ' (both of them)

>> do
>>    chown $I.pippo $I
>> done

This will make the groupid of all folders "pippo". If you don't want to change 
the groupid, delete the ".pippo" from the chown command.

Paul.




More information about the fedora-list mailing list