bash logic work