map/reduce in bash