bash: Handle errors in echo