Operating System - HP-UX
1834814 Members
2431 Online
110070 Solutions
New Discussion

Re: Andreas I have a question.. see attached

 
SOLVED
Go to solution
rmueller58
Valued Contributor

Andreas I have a question.. see attached

Is there a way to use Andreas script with ownership/and group?
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x9bdefef4d250d611abdb0090277a778c,00.html
2 REPLIES 2
harry d brown jr
Honored Contributor

Re: Andreas I have a question.. see attached

#!/sbin/sh
find /var/adm/sw/products -name INFO -exec cat {} \; |
awk '{
if($1 == "path") path=$2;
if($1 == "owner" && path ~ "^/") printf("chown %s %s\n",$2, path);
if($1 == "group" && path ~ "^/") printf("chgrp %s %s\n",$2, path);
}' | sort -u >perm_reset.sh



live free or die
harry
Live Free or Die
John Palmer
Honored Contributor
Solution

Re: Andreas I have a question.. see attached

Try changing it to:-

find /var/adm/sw/products -name INFO -exec cat {} \; |
awk '{
if($1 == "path") path=$2;
if($1 == "owner") owner=$2;
if($1 == "group" && path ~ "^/") printf("chown %s:%s %s\n",owner,$2,path);
}' | sort -u > perm_reset.sh

Regards,
John