doesn't bash have some stuff built in to make this a bit cleaner?