ported to bash with beep, still a buggy