Nested While Loop Bash Linux If Statement