Add grep -c flag playground

This commit is contained in:
t0xa 2025-12-08 11:14:21 +03:00
parent ac8055314c
commit 742f87567d
2 changed files with 11 additions and 0 deletions

1
grep_c/file.txt Normal file
View file

@ -0,0 +1 @@
pattern

10
grep_c/grep_c.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
timeout 10 bash -c '
until [ $(grep -c "pattern" file.txt) -gt 0 ]; do
echo "pattern not found, sleeping for 2 secs..."
sleep 2
done
'
echo "pattern found! Exiting"