#!/bin/bash
logfile_name=add_users_`date +%Y_%m_%d`_00.log
i=1
flag=false
while [ -f $logfile_name ]; do
     logfile_name=add_users_`date +%Y_%m_%d`_0$i.log
     let i+=1
done

cat demo.txt | while read line; do
    username=`echo $line | awk '{print $1}'`
	email=`echo $line | awk '{print $2}'`
	name=`echo $line | awk '{print $3}'`
    password=`echo $line | awk '{print $4}'`	
    if [ -z $password ]; then
        password=demo
    fi
    curl -d "password=$password&email=$email&username=$username&name=$name&private_token=BDMbrATmHycDp3BsKayx" "http://gitabc.xyqb.com/api/v3/users"
    echo $password | passwd --stdin $username
    echo "$username : $password"
done
