shellnewbie
Technical User
Dear all,
As i am trying to set-up quotas on users'home.
I would like to have all uid and gid the same for those user's directories. Then find out all the sub files and folder who's GID is different from UID, and send them to a file.
Here is a sample of my working directory :
drwxrwx--- 14 4100 4100 4096 Apr 30 2008 user1
drwxr-x--- 30 50037 20184 4096 Apr 30 2008 user2
drwxrwx--- 6 50161 50161 4096 May 01 2008 superad2
drwxrwx--- 35 50236 50236 4096 May 01 2008 superad3
SERVER$ls -ld * | awk '{if ($3==$4) print $0}'
this line removed folder who have a wrong gid on the folder home's user. ==>
such as this line :
drwxr-x--- 30 50037 20184 4096 Apr 30 2008 user2
then when i only have uid with same gid folders, im trying to make a find command which i will reuse in a bash shell to execute all those find and redirect the result in a file.
SERVER$ls -ld * | awk '{if ($3==$4) print "find",$NF " -ls | awk" "{if ($3 != $4) print $0 }"}'
find user1 -ls | awk{if ($3 != $4) print $0 }
find user2 -ls | awk{if ($3 != $4) print $0 }
The problem is that im missing the quotes for my if.
There undoubtly on awk-line command able to do what im searching for. but as i am still learning bash, and because my programming skills are quite weak, i beg your help.
eager to understand better.
Thanks
French_dude.
As i am trying to set-up quotas on users'home.
I would like to have all uid and gid the same for those user's directories. Then find out all the sub files and folder who's GID is different from UID, and send them to a file.
Here is a sample of my working directory :
drwxrwx--- 14 4100 4100 4096 Apr 30 2008 user1
drwxr-x--- 30 50037 20184 4096 Apr 30 2008 user2
drwxrwx--- 6 50161 50161 4096 May 01 2008 superad2
drwxrwx--- 35 50236 50236 4096 May 01 2008 superad3
SERVER$ls -ld * | awk '{if ($3==$4) print $0}'
this line removed folder who have a wrong gid on the folder home's user. ==>
such as this line :
drwxr-x--- 30 50037 20184 4096 Apr 30 2008 user2
then when i only have uid with same gid folders, im trying to make a find command which i will reuse in a bash shell to execute all those find and redirect the result in a file.
SERVER$ls -ld * | awk '{if ($3==$4) print "find",$NF " -ls | awk" "{if ($3 != $4) print $0 }"}'
find user1 -ls | awk{if ($3 != $4) print $0 }
find user2 -ls | awk{if ($3 != $4) print $0 }
The problem is that im missing the quotes for my if.
There undoubtly on awk-line command able to do what im searching for. but as i am still learning bash, and because my programming skills are quite weak, i beg your help.
eager to understand better.
Thanks
French_dude.