misc bash functions