Operating System - HP-UX
1829403 Members
1907 Online
109991 Solutions
New Discussion

List user .profile content

 
Intothenewworld
Advisor

List user .profile content

I use unix server , I know each user local directory have a .profile which have the user's setting , as our system have been migrated many times , they have different .profile , so I would like to know their setting .

can advise if I would like to list all these .proifle file content with the corresponding user id , just like as below , what can i do ? Thanks.


user  .profile
====  ========
Peter  PATH=$PATH:$HOME/bin
  umask 000
  export ORI=/sbin/ori

Mary  PATH=$PATH:$HOME:.:/sbin
  export TH=OI

TOM  PATH=$PATH:$HOME:.:/sbin
  ege=/sbin/ege/uni

"

"

 

1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: List user .profile content

>I would like to list all these .profile file content with the corresponding user id

 

I have 100s of lines in my .profile.  Do you want all of those lines listed under each?

 

#!/usr/bin/ksh
# list .profile
echo "User     .profile"
echo "======== ========"
awk -F: '{print $1, $6}' /etc/passwd | while read user home_dir; do
   typeset -L8 userfmt=$user
   echo "$userfmt $home_dir/.profile"
   if [ ! -f $home_dir/.profile ]; then
      echo "$userfmt not available"
      break
   fi
   echo "$user"
   cat $home_dir/.profile
done