list file
I use Redhat server , I know each user local directory have a .forward file which re-direct the mail , can advise if I would like to list all the .forward file content and the corresponding user id , just like as below , what can i do ? Thanks.
user id .forward ======== ======== user1 user1@domain.com user2 user2@domain.com user3 user3@domain.com " " " " |
If I understand well the main problem is to retrieve the list of users and their home directories, right? The most straightforward method is to parse the /etc/passwd file using awk. For example, suppose the real (not system) users have ID greater than (or equal to) 500:
Code:
# awk -F: '$3 >= 500 {if ((getline email < ($6 "/.forward")) > 0) print $1, email}' /etc/passwd |
Quote:
I tried your method , but no output . what I would like is just to list all user's .forward content . thx |
Can I just query
Quote:
In fact its been a long time since I've seen one 'in the wild' It is normal to have /etc/aliases setup, which is more like a system wide .forward. |
Quote:
No need to worry if the .forward or not , I just would like to know the content of .forward file . Thx |
Hi,
quick and dirty. Assumes user home dirs are in /home: Code:
cat /home/*/.forward Code:
for f in /home/*/.forward ; do echo $f; cat $f ;done to determine the users home directory (similar to coulix's method). HTH, Evo2. |
All times are GMT -5. The time now is 04:07 PM. |