Bash Wait For Command To Finish In Loop