fix bash rule and logic