I need a single line bash command that takes a piped input and returns true or false depending if it match a string or not..
This seems to work for the true or false part:
test `expr match "Release:11.04" "Release:11.04"` = 13 && echo true || echo false
But I cannot get it to work properly with the other command's output..
What I need would be something like this:
test `expr match "`lsb_release -r`" "Release:11.04"` = 13 && echo true || echo false
So I tried with xargs, but I can't get it to work:
lsb_release -r | xargs -I {} test `expr {} "Release: 11.04"` = 13 && echo True || echo False
Also, if any of you happens to know a shorter way to achieve this, it would be greatly welcome.