title: Can any one help me in writing a script for the following scenario
body: <p>Can any one help me in writing a script for the following scenario!! </p>
  
  <ul>
  <li>usera belongs to groupa and usera has access to "groupa" filesystem</li>
  <li>userb belongs to groupb and userb has access to "groupb" filesystem</li>
  <li>userc belongs to groupc and userc has access to "groupc" filesystem</li>
  <li>userd belongs to groupd and userd has access to "groupd" filesystem</li>
  </ul>
  
  <p>Note:- group name and filesystem are identical.</p>
  
  <p>Help me in writing a script, when a user logs in, group name to be identified and execute</p>
  
  <pre><code>df -h */group_name*
  </code></pre>
  
  <p>for example:- if usera logs in, then we need to o/p of "df -h /groupa"</p>
  
  <pre><code>[root@server5 ~]# df -h /groupa
  Filesystem            Size  Used Avail Use% Mounted on
  /dev/groupa             601T  477T  125T  80% /groupa
  [root@server5 ~]#
  </code></pre>
  
  <p>need to write a write by putting some logic, everytime a user login into the system, this script need to run and produce output on his/her terminal. We are trying to provide information to user about his filesystem utilization. This can be done by putting this script inside /etc/profile.d/ directory. user information can be taken from $USER variable and group information can be find out by "id -gn"</p>
  
  <p>note:- some of the filesystem are like given below.</p>
  
  <p>/filesystem/groupe</p>
  
  <ul>
  <li>usere belongs to groupe and usere has access to "/filesystem/groupe" filesystem </li>
  </ul>
  
  <p><strong>I solved my problem by using the below given script:-</strong></p>
  
  <pre><code>grp=$(id -gn)
  if [ "$grp" == "groupa" ]
  then
      df -h /groupa
  else
      if [ "$grp" == "groupb" ]
      then
          df -h /groupb
      else
          if [ "$grp" == "groupc" ]
          then
              df -h /groupc
          else
              if [ "$grp" == "groupd" ]
              then
                  df -h /groupd
              else
                  if [ "$grp" == "groupe" ]
                  then
                      df -h /filesystem/groupe
                  fi
              fi
          fi
      fi
  fi
  </code></pre>