[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: home directories...



Bradley Bell wrote:
  >I need to write a script which will run once a night, and check each
  >user's home directory for a certain file.  Does anybody know the best way
  >to do this?  The only thing I can think of is to parse /etc/passwd to get
  >the home dir of each user of UID > 999. Is this the correct way to do it?
 
If all your home directories are in /home/<username> you would not need
to parse /etc/passwd; just do "cd /home; for f in `ls`; do ...; done"

  >What routines should one use when parsing /etc/passwd?
 
awk -F: '{if ($3 > 999) print $1}' </etc/passwd


-- 
      Vote against SPAM: http://www.politik-digital.de/spam/
                 ========================================
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "Use hospitality one to another without grudging."     
                                   I Peter 4:9 



Reply to: