fixed logic error in grep command use