Add grep -c flag playground
This commit is contained in:
parent
ac8055314c
commit
742f87567d
2 changed files with 11 additions and 0 deletions
1
grep_c/file.txt
Normal file
1
grep_c/file.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
pattern
|
||||||
10
grep_c/grep_c.sh
Executable file
10
grep_c/grep_c.sh
Executable 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"
|
||||||
Loading…
Reference in a new issue