bash script first draft -- fully functional