#!/bin/bash n=1 while [ $n -le 5 ] do n=$(( $n + 1 )) user=user$n userdel -r $user echo "$user was removed from system" useradd $user echo "$user" | passwd --stdin $user > /dev/null echo "$user is added to system" done