#!/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 for i in 1 2 3 4 5 6 do if [ "$fwrd$i" != "" ];then echo "&$fwrd$i" >> $file fi done done