CORE/count_characters.sh
JeremyStarTM 83ea84b9ab Documentation/website release and more
This commit added:
- A website and documentation (two in one) containing a install guide and code references
- Character counting script (count_characters.sh)
- Godot development project support (making a temporary godot project)
- Makefile
2023-07-09 00:16:15 +02:00

36 lines
1 KiB
Bash
Executable file

#!/bin/bash
function dircount() {
if [ "$VERBOSE" == "true" ]; then echo ":: Checking directory \"$*\"..."; fi
cd "$*" || exit 54
for file in $FILEEXTENSION; do
export "file_full=$*/$file"
if [ -d "$file" ]; then
dircount "$file_full"
elif [ -f "$file" ]; then
if [ "$IGNORE_SCRIPT" == "true" ] && [ "$file" == "count_characters.sh" ]; then
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping this script"; fi
else
if [ "$VERBOSE" == "true" ]; then echo ":: Counting characters in file \"$file_full\"..."; fi
export "COUNT_FILE=$(wc -m < "$file_full")"
export "COUNT=$((COUNT + COUNT_FILE))"
fi
else
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping \"$file_full\" (no file or directory)"; fi
fi
done
cd ..
}
if [ "$FILEEXTENSION" == "" ]; then
export "FILEEXTENSION=*"
fi
if [ "$*" == "" ]; then
dircount "$(pwd)"
else
dircount "$(pwd)/$*"
fi
if [ "$VERBOSE" == "true" ]; then echo ""; fi
if [ "$NUMBER_ONLY" == "true" ]; then
echo "$COUNT"
else
echo "Characters counted: $COUNT"
fi