bash logic