Tuesday, February 27, 2018

Grep returning if results were found or not

Today I needed a one-liner like this to help with with an Ansible playbook, storing here for posterity:

rpm -qa | grep -q "rhn" && echo 'is installed' || echo 'not installed'

No comments:

Post a Comment