Assorted bash functions