checking if grep command returns correct output

前端 未结 1 1767
我在风中等你
我在风中等你 2021-01-16 04:14

Thing is that I am using wget to extract url after that I want to pipe it to grep to check if it matches some pattern and if it does simply echo name of url.

相关标签:
1条回答
  • 2021-01-16 04:28

    An if condition is true if its command returns 0. grep returns 0 if it matches the pattern to the input.

    if wget -O - ... | grep -q ...
    then
       ...
    fi
    
    0 讨论(0)
提交回复
热议问题