Consider the following command. I want to echo "yes" if grep has output and echo "no" if grep returns no output.
cat myfile | grep "something"
Can I do this without if command?
|
Consider the following command. I want to echo "yes" if grep has output and echo "no" if grep returns no output.
Can I do this without |
|||
|
Use boolean control operators:
|
|||
|
|
|
|
|||||
|
cat, what exactly is your problem withif? Or maybe the correct question is "what are you really trying to do?" – geekosaur May 11 '12 at 16:30