if system 'lpstat -p | grep -q "Eileen"'
puts "do something here"
else
puts "do something else"
end
However, this will lead to the output of the command output to stdout. If you want to avoid this, you can do:
output = %x(lpstat -p | grep -q "Eileen")
if $?.success?
puts "do something here"
else
puts "do something else"
end
source
share