vercmp/sloc.sh

13 lines
420 B
Bash
Executable File

#!/bin/sh
# find all *.sh files not under `format`, strip all trailing whitespace, then
# all leading whitespace, then all lines starting with '#', then all empty
# lines, and then count the remaining lines.
find . -name "*.sh" ! -path "**/format/**" \
| xargs sed 's/[[:space:]]*$//g; s/^[[:space:]]*//g; s/^#.*$//g; /^$/d' \
| wc -l - \
| cut -d' ' -f1
# note that this script's ELOC is also included in the count.