#!/usr/local/bin/bash while read inputline do maine="$(echo $inputline | awk '{print $1}')" typee="$(echo $inputline | awk '{print $2}')" fwrd1="$(echo $inputline | awk '{print $3}')" fwrd2="$(echo $inputline | awk '{print $4}')" fwrd3="$(echo $inputline | awk '{print $5}')" fwrd4="$(echo $inputline | awk '{print $6}')" fwrd5="$(echo $inputline | awk '{print $7}')" fwrd6="$(echo $inputline | awk '{print $8}')" usernm="$(echo $maine | awk -F @ '{print $1}')" if [ "$typee" == "A" ]; then /usr/local/bin/vadduser $maine # replace with your password file=$usernm/.qmail echo "$file" else file=".qmail-$usernm" echo "$file" fi if [ "$fwrd1" != "" ];then echo "&$fwrd1" >> $file fi if [ "$fwrd2" != "" ];then echo "&$fwrd2" >> $file fi if [ "$fwrd3" != "" ];then echo "&$fwrd3" >> $file fi if [ "$fwrd4" != "" ];then echo "&$fwrd4" >> $file fi if [ "$fwrd5" != "" ];then echo "&$fwrd5" >> $file fi if [ "$fwrd6" != "" ];then echo "&$fwrd6" >> $file fi done