Page MenuHomePhabricator
Paste P11336

Shell script for count number of `it` statements
ActivePublic

Authored by Soham on May 29 2020, 2:01 PM.
```
#!/bin/bash
count_it_recursive () {
shopt -s nullglob dotglob
for pathname in "$1"/*; do
if [ -d "$pathname" ]; then
count_it_recursive "$pathname"
else
case "$pathname" in
*.js)
grep -w -c -E "it(\.skip)?\(\s'.*'" "$pathname"
esac
fi
done
}
count_it_recursive $1
```
To trigger:
`sh count_it.sh PATH_TO_DIR`