<!--
.. title: bash: условие если вывод команды содержит строку
.. slug: bash-if-grep
.. date: 2026-09-24 13:21:03 UTC+03:00
.. tags: bash, linux 
.. category: 
.. link: 
.. description: 
.. type: text
-->



```bash

if SomeCommand | grep -q 'TextToFind'; then
  echo "TextToFind was found in SomeCommand output"
else
  echo "No TextToFind in SomeCommand output found"
fi

```
