Our convention for bash scripts is to always reference variables using ${x} (not just $x). Please adjust these three references.